expm() products NaN as answer.

2 次查看(过去 30 天)
xinyu
xinyu 2014-5-20
编辑: Matt J 2014-5-20
I have the matrix
A=1.0 e 04*
1.3371 0.0000 0 0
0.0130 -0.0000 0 0
0.0000 0 -0.0001 0.0001
0.0000 0 -0.0001 0.0001
Only 0 is a real 0 and 0.0000 is because the number is too small to show at such a scale. The expm(A) gives NaN as ans. I thought it is because of the matrix is badly scaled. But it works fine for expm(-A). So, where the problem is and how can I get the right ans?

回答(1 个)

Matt J
Matt J 2014-5-20
编辑:Matt J 2014-5-20
It is badly scaled. Try
>> expm(A/1e4) %finite result, better scaled
Now try computing expm(A) in the following equivalent way,
>> expm(A/1e4)*exp(1e4) %the desired computation, but non-finite result
The fact that exp(1e4)=Inf ruins everything.

类别

Help CenterFile Exchange 中查找有关 Linear Algebra 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by