在嵌套计算中,会调用一些函数,程序运行后总提示Conversion to double from sym is not possible.
比如,下面一段程序也会提示Conversion to double from sym is not possible.
function F=fun2(q);
syms i q;
N=10;
x=0;
p1=60;
p2=71.4;
a2=11.1;
b2=2.8;
F(1)=0;
for i=1:N
r(i)=p1*x-15*q(i) %阶段函数
F(i+1)=-r(i)+F(i)
x=q(i)-a2+b2*p2-5*p1
end
请各位帮忙,非常感谢!



雷达卡



京公网安备 11010802022788号







