How to calculate expm of a badly scaled matrix?

조회 수: 8 (최근 30일)
alex corno
alex corno 2013년 6월 4일
I'm using expm for a matrix with big and small coefficients and I get NaN in the result. Is there a method to get the good matrix exponential even if the matrix is badly scaled? Normally there is a exponential for every matrix.
ALEX
  댓글 수: 2
Matt J
Matt J 2013년 6월 4일
편집: Matt J 2013년 6월 4일
Suppose you had a simple badly scaled matrix like
>> A=diag( [1e6,1] )
A =
1000000 0
0 1
What would you like the result of expm(A) to be? The following has no NaNs. Would it be an okay answer?
>> expmA=diag( exp([1e6,1]) )
expmA =
Inf 0
0 2.7183
alex corno
alex corno 2013년 6월 4일
I think I have a different problem. My matrix isn't even invertible, there are two zero lines, moreover there are some coefficients that are of order of 1e6. In my opinion at some point Matlab is doing some inversion that's why expm doesn't work properly with badly scaled matrices. In my problem I changed the units of physical parameters (distance -> µm Stresses -> kPa) and now it works. But I'm looking for some existent function (transformation) which would enable to calculate expm for any matrix (apart for huge numbers that shouldn't appear in a physical problem there's no chance that e^100 will be a coefficient in a transfer matrix)
Alexandru

댓글을 달려면 로그인하십시오.

채택된 답변

Richard Brown
Richard Brown 2013년 6월 5일
In particular, have you tried the alternative versions expmdemo1 and expmdemo3 ?

추가 답변 (2개)

Matt J
Matt J 2013년 6월 4일
편집: Matt J 2013년 6월 4일
I think I have a different problem. My matrix isn't even invertible, there are two zero lines, moreover there are some coefficients that are of order of 1e6. In my opinion at some point Matlab is doing some inversion that's why expm doesn't work properly with badly scaled matrices.
No, it's not an invertibility issue. The reason for the NaNs is the big 1e6 order numbers. Below is an example of a non-invertible matrix on which EXPM works fine.
>> expm(diag([1,0]))
ans =
2.7183 0
0 1.0000
  댓글 수: 3
alex corno
alex corno 2013년 6월 4일
Yes, OK but is there a way in Matlab(a transformation or something) to get expm even if the matrix is badly scaled? In my case I just changed the units of my unknowns but is there a better method?
Matt J
Matt J 2013년 6월 4일
편집: Matt J 2013년 6월 4일
Even if the matrix is well-scaled, you could have the same problem, for example:
>> A=diag([1e6,1e6]); %a well-scaled matrix
>> expm(A)
ans =
NaN NaN
NaN NaN
The bottom line is, you must avoid matrices with large eigenvalues, and then things should be fine. Otherwise, they will not be fine.
There are any number of transformations you could consider to reduce the magnitude of the eigenvalues. Dividing the matrix by a large number is one way, but I can't know if that suits your application.

댓글을 달려면 로그인하십시오.


alex corno
alex corno 2013년 6월 5일
Thank you for your help. I think the function balance() is what I was looking for.
Alexandru

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by