24小时热门版块排行榜    

查看: 2248  |  回复: 0

mataohk

银虫 (初入文坛)

[求助] Matlab:求高人指点用matlab求解非线性方程组,解出来的值不收敛,提前结束

fsolve解非线性方程组,只迭代了8次就退出了,得到的结果进行复算不等于0,存在较大的误差。(是不是需要修改算法?)
运行程序得到的结果提示如下:
x =

  1.0e+003 *

  Columns 1 through 4

   0.008229968721187   0.000000000008083   0.000006858621379   1.206234368839563

  Column 5

   0.000029820218392


fval =

  -0.003404951183545
   0.109922506812515
   0.055200484333056
   0.009207767273016
  -0.000813641543979


exitflag =

    -2


output =

       iterations: 8
        funcCount: 54
        algorithm: 'trust-region dogleg'
    firstorderopt: 3.163833174781097e+003
          message: [1x775 char]


ans =

No solution found.

fsolve stopped because the relative size of the current step is less than the
selected value of the step size tolerance squared, but the vector of function values
is not near zero as measured by the selected value of the function tolerance.

Stopping criteria details:

fsolve stopped because the relative norm of the current step, 2.142692e-011, is less than
max(options.TolX^2,eps) = 2.500000e-011. However, the sum of squared function values,
r = 1.522709e-002, exceeds sqrt(options.TolFun) = 1.000000e-025.

Optimization Metric                                               Options
relative norm(step) =  2.14e-011                max(TolX^2,eps) =  3e-011 (selected)
r =  1.52e-002                                    sqrt(TolFun) = 1.0e-025 (selected)


程序代码如下:(其中调用了mafun函数,mafun函数中包括五个方程组,Iph,Io,Rs,Rp,Vt是要求的参数,已经赋初值,可以保证初值选择正确,因为所有解的范围是可以估计到的)
options = optimset('Display','iter','TolFun',1e-50,'TolX',0.5e-5);
[x,fval,exitflag,output] = fsolve(@mafun,x0,options)
output.message
format long, x,

如果我将程序中的optimset括号中的“0.5e-5”改为“0.5e-20”,则得到的结果为(好像说是变成奇异方程了):
No solution found.

fsolve stopped because the problem appears to be locally singular.

Stopping criteria details:

fsolve stopped because the trust-region radius, 1.248209e-016, is less than 2*eps.

Optimization Metric                                             Options
trust-region radius =  1.25e-016                              2*eps = 4.4e-016

上面的问题已经说的很详细了,希望高手能帮忙解决。谢谢了。 只有那么多Q币,全给了。

[ Last edited by mataohk on 2012-9-30 at 09:32 ]
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

智能机器人

Robot (super robot)

我们都爱小木虫

相关版块跳转 我要订阅楼主 mataohk 的主题更新
信息提示
请填处理意见