matlab用fsolve求解非线性方程组,无法求解……

2024-11-08 15:12:22
推荐回答(1个)
回答(1):

给你看了,gf是matlab已有的函数名了,可输入help gf 查看,因此你定义了一个和gf函数重名的自己的函数,把gf随便改成另一个名字,如myfun,fsolve里也要改,不要跟matlab内置的函数重名,否则系统不识别哪一个是你想要求解的,这就叫机器与人脑的本质区别,调用结果如下:
[xybest,fval]=fsolve('myfun',[195.3,0.001,389.3,249.4])
Equation solved, fsolve stalled.
fsolve stopped because the relative size of the current step is less than the
default value of the step size tolerance squared and the vector of function values
is near zero as measured by the default value of the function tolerance.


xybest =
195.2302 0.0011 389.2688 249.3868

fval =
1.0e-011 *
0
0
-0.7276
0
注意:切记不要再犯这种错误,大多数人也查不出来的错误,加油。。。