我在做东西时,需要用到牛顿迭代法对非线性方程组求解,可是我的程序总是出错的,请高手帮我修改一下啊,下面附上我写的程序啊,谢谢啊
function [r,n]=mulNewton3(F,x0,eps)
if nargin==1
eps=1.0e-4;
end
J=jacobian(sym(F));
fa=subs(sym(F),x0);
fb=subs(sym(J),x0);
r=x0-fa/fb;
n=1;
tol=1;
while tol>eps
x0=r;
r=x0-fa/fb;
tol=norm(r-x0);
n=n+1;
if(n>100000)
disp('******');
return;
end
end