用matlab求解不等方程组,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]
總結
以上是生活随笔為你收集整理的用matlab求解不等方程组,Matlab:求高人指点用matlab求解非线性方程组,解出来的值不收敛,提前结束...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 姜和红糖怎么熬?
- 下一篇: 没有业务往来可以转让承兑吗?