matlab 非线性方程组已知某非线性方程组如下:ff(1)=(3-5*x(1))*x(1)+1-2*x(2)=0for

1个回答

  • function hh X0=[0.0079 -0.0386 -0.0864 0.0466 -0.0166 -0.1171 0.0661 -0.0327 -0.1910 0.0831]; [X,FVAL,EXITFLAG]=fsolve(@myfun,X0) function ff=myfun(x) ff(1)=(3-5*x(1))*x(1)+1-2*x(2); for k=2:9 ff(k)=(3-5*x(k))*x(k)+1-x(k-1)-2*x(k+1); end ff(10)=(3-5*x(10))*x(10)+1-x(9); 结果:Optimization terminated:first-order optimality is less than options.TolFun.X = -0.3821 -0.4381 -0.4459 -0.4470 -0.4470 -0.4464 -0.4441 -0.4362 -0.4079 -0.3096 FVAL = 1.0e-007 * 0 -0.0000 -0.0000 -0.0000 -0.0001 -0.0008 -0.0073 -0.0454 -0.1214 -0.0278 EXITFLAG = 1