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 Center および File ExchangeLinear Algebra についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by