fsolve解非线性方程组的时候输出与所设初值一致是怎么回事?
在程序运行时老是出现:
Optimization terminated: no further progress can be made.
Trust-region radius less than 2*eps.:loveliness:
Problem may be ill-conditioned or Jacobian may be inaccurate.
Try using exact Jacobian or check Jacobian for errors.
请各位帮忙看一下我的程序是怎么回事啊!我是用fsolve解五个非线性方程组:
子函数:
function F=tttfun(x)
n1=3;
n0=2;
n2=-2;
lamda=2;
d0=10*lamda;
d1=2*lamda;
d2=4*lamda;
k0=2*pi/lamda;
h1=sqrt(n1^2*k0^2-x(1)^2);
p1=sqrt(x(1)^2-n0^2*k0^2);
q1=sqrt(x(1)^2-n2^2*k0^2);
m1=(h1*cos(h1*d1)+p1*sin(h1*d1))*(x(5)*q1*sinh(q1*d2/2)*cosh(p1*(d0-d2)/2)+p1*cosh(q1*d2/2)*sinh(p1*(d0-d2)/2))/h1;
n1=(h1*sin(h1*d1)-p1*cos(h1*d1))*(x(5)*q1*sinh(q1*d2/2)*sinh(p1*(d0-d2)/2)+p1*cosh(q1*d2/2)*cosh(p1*(d0-d2)/2))/p1;
y1=m1-n1;
h2=sqrt(n1^2*k0^2-x(2)^2);
p2=sqrt(x(2)^2-n0^2*k0^2);
q2=sqrt(x(2)^2-n2^2*k0^2);
m2=(h2*cos(h2*d1)+p2*sin(h2*d1))*(1/(x(5))*q2*sinh(q2*d2/2)*cosh(p2*(d0-d2)/2)+p2*cosh(q2*d2/2)*sinh(p2*(d0-d2)/2))/h2;
n2=(h2*sin(h2*d1)-p2*cos(h2*d1))*(1/(x(5))*q2*sinh(q2*d2/2)*sinh(p2*(d0-d2)/2)+p2*cosh(q2*d2/2)*cosh(p2*(d0-d2)/2))/p2;
y2=m2-n2;
h3=sqrt(n1^2*k0^2-x(3)^2);
p3=sqrt(x(3)^2-n0^2*k0^2);
q3=sqrt(x(3)^2-n2^2*k0^2);
m3=(h3*cos(h3*d1)+p3*sin(h3*d1))*(x(5)*q3*cosh(q3*d2/2)*cosh(p3*(d0-d2)/2)+p3*sinh(q3*d2/2)*sinh(p3*(d0-d2)/2))/h3;
n3=(h3*sin(h3*d1)-p3*cos(h3*d1))*(x(5)*q3*cosh(q3*d2/2)*sinh(p3*(d0-d2)/2)+p3*sinh(q3*d2/2)*cosh(p3*(d0-d2)/2))/p3;
y3=m3-n3;
h4=sqrt(n1^2*k0^2-x(4)^2);
p4=sqrt(x(4)^2-n0^2*k0^2);
q4=sqrt(x(4)^2-n2^2*k0^2);
m4=(h4*cos(h4*d1)+p4*sin(h4*d1))*(1/(x(5))*q4*cosh(q4*d2/2)*cosh(p4*(d0-d2)/2)+p4*sinh(q4*d2/2)*sinh(p4*(d0-d2)/2))/h4;
n4=(h4*sin(h4*d1)-p4*cos(h4*d1))*(1/(x(5))*q4*cosh(q4*d2/2)*sinh(p4*(d0-d2)/2)+p4*sinh(q4*d2/2)*cosh(p4*(d0-d2)/2))/p4;
y4=m4-n4;
y5=2*x(1)-x(2)-2*x(3)+x(4);
F=[y1;y2;y3;y4;y5];
主函数:
clear,clc
x0 = [1,1,1,1,1]; % Make a starting guess at the solution
options=foptions;
options(1)=1; %设置显示输出中间结果
X=fsolve('tttfun',x0,options);
但是不管怎么改初值,输出都与初值一致,或者是NON
请大家帮帮忙啊!