我需要解一个五元方程组,首先使用matlab中的fsolve,我所设置的迭代次数为10000次,但是每次跑到400次就停了,而且还会报“solver stopped prematurely.fsolve stopped because it exceeded the iteration limit, options.MaxIterations=400(the default value).”我不知道原因。后面考虑到fsolve初值选取比较难,考虑用1stopt去解,仍然解不出来,我想着没有精确解,有个看得过去的近似解也行啊。但是始终没解。有没有人能帮忙看看为什么前面两种方法解不出来,或者是提供一些解答的新思路啊,谢谢大家了!
1、matlab代码
x = sym('x', [1,2,3,4,5],'positive');
% 生成符号变量向量
w1=sqrt((x(1)+x(3)*x(4))./(2*x(2)*x(4)*x(5)));
z=((2*x(2)*x(4)+x(3)*x(4)*x(5))./(2*(x(1)+x(3)*x(4))))*w1;
w2=sqrt(1-z^2)*w1;
a=sqrt((1-2*x(5)*z*w1+x(5)^2*w1^2)./(1-z^2));
f1=atan((w2*x(5))./(1-z*w1*x(5)))-atan((sqrt(1-z^2)./(-z)));
% 参数组成的表达式
eq1=-0.5*x(4)*a./(x(1)+x(3)*x(4))+0.7959;
eq2=z*w1-1.275;
eq3=w2-2.284;
eq4=f1+0.4204;
eq5=-0.5*x(4)./(x(1)+x(3)*x(4))+0.3504;
f = matlabFunction([eq1;eq2;eq3;eq4;eq5], 'vars', {[x(1) x(2) x(3) x(4) x(5)]});
x0 = [0.5 2.5 1 0.05 0.2];
options=optimset('Display','iter','MaxFunEvals',10000,'TolFun',1e-10);
[x,fval,exitflag,output] = fsolve(f,x0,options);
2、1stopt
const delta=-0.5;
parameter x1[0,5],x2[0,5],x3[0,5],x4[0,1],x5[0,5];
conststr
w1=sqrt((x1+x3*x4)/(2*x2*x4*x5));
z=((2*x2*x4+x3*x4*x5)/(2*(x1+x3*x4)))*w1;
w2=sqrt(1-z^2)*w1;
a=sqrt((1-2*x5*z*w1+x5^2*w1^2)/(1-z^2));
f1=atan((w2*x5)/(1-z*w1*x5))-atan(sqrt(1-z^2)./(-z));
//参数组成的表达式
A=delta*x4*a/(x1+x3*x4)+0.7959;
B=z*w1-1.275;
C=w2-2.284;
E=f1+0.4204;
F=delta*x4/(x1+x3*x4)+0.3504;
![求解高次方程组(5次,matlab&1stopt)]()
matlab出错图 |