您的位置:首页 > 编程语言 > MATLAB

MATLAB中用solve和fsolve求解非线性方程组

2016-09-01 14:39 288 查看
1.用solve命令求解

clc;
clear;
syms x2
j=1;
su=0;
x1=2;
jie=solve((x1-x1^(-1)*x2^2)/(1-(x1^2+x2^2+x1^(-2)*x2^(-2)-3)/69)==su,x2);


2.用fsolve
   ◆写好function函数

function F = myfun(x)
F = [2*x(1) - x(2) - exp(-x(1));
-x(1) + 2*x(2) - exp(-x(2))];


  ◆ 写好实现函数

x0 = [-5; -5];  % Make a starting guess at the solution
options = optimoptions('fsolve','Display','iter'); % Option to display output
[x,fval] = fsolve(@myfun,x0,options) % Call solver
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: