matlab 方程组不能编译,用matlab求非线性方程组的解,为何解都不能使第二个方程成立?...

用matlab求非线性方程组的解,但是求得的解代入第2、3、4个方程后,其方程都不等于0,为什么?

第一步,myfun.m如下:

function F = myfun(x)

F=9.1-(6.02)*(1+x(2)*exp(4*x(3)))*(x(4)^1.5-1)/(x(1)*x(2)*exp(4*x(3)));

14.2-(16.82)*(1+x(2)*exp(14*x(3)))*(x(4)^1.5-1)/(x(1)*x(2)*exp(14*x(3)));

8.4-(44.02)*(1+x(2)*exp(22*x(3)))*(x(4)^1.5-1)/(x(1)*x(2)*exp(22*x(3)));

10.4-(127.39)*(1+x(2)*exp(32*x(3)))*(x(4)^1.5-1)/(x(1)*x(2)*exp(32*x(3)));

第二步:

x0 = [1;1;0.01;1];

options=optimset('Display','iter');

[x,fval] = fsolve(@myf,x0,options)  % Call solver

结果为:

Warning: Trust-region-dogleg algorithm of FSOLVE cannot handle non-square systems; using Levenberg-Marquardt

algorithm instead.

> In fsolve at 314

First-Order                    Norm of

Iteration  Func-count    Residual       optimality      Lambda           step

0           5           82.81             161         0.01

1          10         1.17548            23.6        0.001       0.513936

2          15       0.0031149            1.14       0.0001      0.0342564

3          20    2.61253e-008          0.0033       1e-005     0.00195934

4          25    1.85746e-018       2.78e-008       1e-006   5.70737e-006

5          30    3.15544e-030       3.62e-014       1e-007   4.81251e-011

Equation solved.

fsolve completed because the vector of function values is near zero

as measured by the default value of the function tolerance, and

the problem appears regular as measured by the gradient.

x =

1.0116

1.0057

0.0328

1.4889

fval =

1.7764e-015

第三步:代入第二个方程

r2=(16.82)*(1.0057+1.0057*exp(14*0.0328))*(1.4889^1.5-1)/((1.0116*1.0057)*exp(14*0.0328))

r2 =

22.1604

根据第二个方程这个值应当是14.2。所以有问题?为什么呢?

谢谢了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值