作业帮 > 综合 > 作业

MATLAB怎样优化程序快速运算出结果

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/07/13 17:15:39
MATLAB怎样优化程序快速运算出结果
syms x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22
x=[0 0 0 0 0 0 0 0 0 0 0 0 0 0];
for x9=0:2
for x10=0:3
for x11=0:3
for x12=0:4
for x13=0:4
for x14=0:4
for x15=0:5
for x16=0:5
for x17=0:5
for x18=0:5
for x19=0:5
for x20=0:6
for x21=0:5
for x22=0:5
if (x9+x10+x11+x12+x13+x14+x15+x16+x17+x18+x19+x20+x21+x22==8)&&(7*x9+7.5*x10+8*x11+8.5*x12+9*x13+9.5*x14+10*x15+10.5*x16+11*x17+11.5*x18+12*x19+12.5*x20+13*x21+13.5*x22==89)
x=[x;x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22]
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
不会也在做数学建模吧,这样是最容易想的,但是时间太长了,没有必要用syms,可以用递归
你看看啊两个等式(2shi-1shi*7)*2=x10+2x11+3x12+...=..
再判断x10 x11 x12的范围,另外还有个限制x10+x11+...