matlab 迭代求解

x=fsolve(fun,x0)求解fun(x)=0的解,x0是初值,fun是函数,x是解
因为fsolve使用迭代法求解方程的,所以要有个迭代的初值x0。
比如解方程组
x(1).^2+x(2).^2=1
x(1)=2*x(2)
可以写成
f=@(x)([x(1).^2+x(2).^2-1;x(1)-2*x(2)])
x=fsolve(f,[1 1])
这里[1 1]就是初值。
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s