필터 지우기
필터 지우기

Getting Nan after using expm

조회 수: 7 (최근 30일)
raha ahmadi
raha ahmadi 2021년 6월 1일
댓글: raha ahmadi 2021년 6월 1일
Hi H dont know why I get Nan in situatin A but not in B.
Thanks in advance
% situation A
r=[1e5,0,0;
0,-2e5,0;
1,1,-5e5]
R=expm(r);
%% situation B
g=[-1e5,0,0;
0,-2e5,0;
1,1,-5e5]
G=expm(g);

채택된 답변

Jan
Jan 2021년 6월 1일
See the help text of expm:
Although it is not computed this way, if A has a full set of eigenvectors V with corresponding eigenvalues D then
% [V,D] = EIG(A) and expm(A) = V*diag(exp(diag(D)))/V
r=[1e5,0,0; 0,-2e5,0; 1,1,-5e5];
exp(diag(D))
% [0; Inf; 0]
This Inf is the cause of the NaN output.
  댓글 수: 1
raha ahmadi
raha ahmadi 2021년 6월 1일
I really appreciate for your quick response. In fact I expect Inf instead of NaN
Wish you all the best

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

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by