# 非线性方程组求解Matlab实现 （多元牛顿方法、Broyden方法、Broyden方法2）

4 篇文章 0 订阅

function jie = multvarnewton3(g1,g2,g3,c)
e=[inf,inf,inf];
syms x y z
k1=g1(x,y,z);k2=g2(x,y,z);k3=g3(x,y,z);
while(norm((e-c),inf)>0.5*10^-6)
f1=diff(k1,x);
f2=diff(k1,y);
f3=diff(k1,z);
f4=diff(k2,x);
f5=diff(k2,y);
f6=diff(k2,z);
f7=diff(k3,x);
f8=diff(k3,y);
f9=diff(k3,z);
d(1)=subs(subs(subs(k1,x,c(1)),y,c(2)),z,c(3));
d(2)=subs(subs(subs(k2,x,c(1)),y,c(2)),z,c(3));
d(3)=subs(subs(subs(k3,x,c(1)),y,c(2)),z,c(3));
a(1,1)=subs(subs(subs(f1,x,c(1)),y,c(2)),z,c(3));
a(1,2)=subs(subs(subs(f2,x,c(1)),y,c(2)),z,c(3));
a(1,3)=subs(subs(subs(f3,x,c(1)),y,c(2)),z,c(3));
a(2,1)=subs(subs(subs(f4,x,c(1)),y,c(2)),z,c(3));
a(2,2)=subs(subs(subs(f5,x,c(1)),y,c(2)),z,c(3));
a(2,3)=subs(subs(subs(f6,x,c(1)),y,c(2)),z,c(3));
a(3,1)=subs(subs(subs(f7,x,c(1)),y,c(2)),z,c(3));
a(3,2)=subs(subs(subs(f8,x,c(1)),y,c(2)),z,c(3));
a(3,3)=subs(subs(subs(f9,x,c(1)),y,c(2)),z,c(3));
a=double(a);
d=double(d);
e=c;
s=a\d';c=(c'-s)';
jie=c;
end
end


function jie= multvarnewton(g1,g2,c)
e=[inf,inf];
syms x y
k1=g1(x,y);k2=g2(x,y);
while(norm((e-c),inf)>0.5*10^-6)
f1=diff(k1,x);
f2=diff(k1,y);
f3=diff(k2,x);
f4=diff(k2,y);
d(1)=subs(subs(k1,x,c(1)),y,c(2));
d(2)=subs(subs(k2,x,c(1)),y,c(2));
a(1,1)=subs(subs(f1,x,c(1)),y,c(2));
a(1,2)=subs(subs(f2,x,c(1)),y,c(2));
a(2,1)=subs(subs(f3,x,c(1)),y,c(2));
a(2,2)=subs(subs(f4,x,c(1)),y,c(2));
a=double(a);
d=double(d);
e=c;
s=a\d';c=(c'-s)';
jie=c;
end
end

Broyden方法

function jie = Broyden(f,tol,x0)
[m,n]=size(x0);
a=eye(n);
x=x0-a\f(x0);
while(norm((x-x0),inf)>tol)
k1=f(x)-f(x0);k2=x-x0;
a=a+(k1-a*k2)*k2'/(k2'*k2);
x0=x;
x=x-a\f(x);
end
jie=x;
end

Broyden方法2

function jie= Broyden2(f,tol,x0)
[m,n]=size(x0);
a=eye(n);
x=x0-a*f(x0);
while(norm((x-x0),inf)>tol)
k1=f(x)-f(x0);k2=x-x0;
a=a+((k2-a*k1)*k2'*a)/(k2'*a*k1);
x0=x;
x=x-a*f(x);
end
jie=x;
end


04-16 1万+
02-10 1万+
04-12
03-17 2283
09-01 6万+
12-31 1165

### “相关推荐”对你有帮助么？

• 非常没帮助
• 没帮助
• 一般
• 有帮助
• 非常有帮助

NCEPU-除尘

¥2 ¥4 ¥6 ¥10 ¥20

1.余额是钱包充值的虚拟货币，按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载，可以购买VIP、C币套餐、付费专栏及课程。