Effacer les filtres
Effacer les filtres

Getting Nan after using expm

7 vues (au cours des 30 derniers jours)
raha ahmadi
raha ahmadi le 1 Juin 2021
Commenté : raha ahmadi le 1 Juin 2021
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);

Réponse acceptée

Jan
Jan le 1 Juin 2021
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 commentaire
raha ahmadi
raha ahmadi le 1 Juin 2021
I really appreciate for your quick response. In fact I expect Inf instead of NaN
Wish you all the best

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Mathematics and Optimization dans Help Center et File Exchange

Tags

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by