非線性方程(組)的求解
阿新 • • 發佈:2018-12-12
Example1:用solve命令求下列非線性方程(組)的解
%求解非線性方程(組)的solve命令
(1)x=solve('8*x^9+17*x^3-3*x=-1','x')
(2)x=solve('sin(cos(2*x^3))=0','x')
(3)
E1=sym('x^x-4=0');
E2=sym('2*x*y+x=1');
[x,y]=solve(E1,E2);
x1=double(x),y1=double(y)
Example2:求解多項式方程(組)的roots命令: ` 解
fa=[8 0 0 0 0 0 17 0 -3 1]; xk=roots(fa)
xk =
-0.9578 + 0.5907i -0.9578 - 0.5907i -0.0062 + 1.1577i -0.0062 - 1.1577i 0.9627 + 0.5748i 0.9627 - 0.5748i -0.5328 + 0.0000i 0.2676 + 0.1958i 0.2676 - 0.1958i`
fa=[8 0 0 0 0 0 17 0 -3 1;]
fa =
8 0 0 0 0 0 17 0 -3 1
dfa=polyder(fa)
dfa =
72 0 0 0 0 0 51 0 -3
dfx=poly2sym(dfa)
dfx =
72x^8 + 51x^2 - 3
Example3:用fsolve求解非線性方程(組)的解
(1)function F= Fun1(x) F=8*x^9+17*x^3-3*x+1; x0=-0.5; x=fsolve('Fun1',x0),F=Fun1(x) (2)function F= Fun2(x) x=x(1),y=x(2); F(1)=x^3-y^2; F(2)=exp(-2)-y; x0=[1,1]; x=fsolve('Fun2',x0),F=Fun2(x)