Hi all, I am trying to run the following but I got an erorr
Error in expm
if ~all(isfinite(A),'all')
How can I fix that error?
H=[ 0.650 0.202 0 0 0 0 0 0 0;0.202 0.650 -0.164 0.066 0 0 0 0 0;0 -0.168 0.779 0.165 0 0 0 0 0;0 0.066 0.165 0.648 -0.164 0.064 0 0 0;0 0 0 -0.164 0.776 0.164 0 0 0;0 0 0 0.064 0.164 0.649 0.168 0.051 0;0 0 0 0 0 0.168 0.547 0.168 0;0 0 0 0 0 0.051 0.168 0.650 -0.168;0 0 0 0 0 0 0 -0.168 0.547];
w=expm(H)

6 commentaires

I don't see any problem.
H=[ 0.650 0.202 0 0 0 0 0 0 0;0.202 0.650 -0.164 0.066 0 0 0 0 0;0 -0.168 0.779 0.165 0 0 0 0 0;0 0.066 0.165 0.648 -0.164 0.064 0 0 0;0 0 0 -0.164 0.776 0.164 0 0 0;0 0 0 0.064 0.164 0.649 0.168 0.051 0;0 0 0 0 0 0.168 0.547 0.168 0;0 0 0 0 0 0.051 0.168 0.650 -0.168;0 0 0 0 0 0 0 -0.168 0.547];
w=expm(H)
w =
1.9549 0.39165 -0.032683 0.011087 -0.00063967 0.00021891 9.5344e-06 3.2559e-06 -1.0882e-07
0.39165 1.9857 -0.32979 0.10175 -0.0092228 0.0030011 0.00017991 6.3289e-05 -2.6524e-06
-0.033498 -0.3381 2.2357 0.3308 -0.027274 0.0089509 0.00051116 0.00017915 -7.3189e-06
0.011043 0.10108 0.33106 1.972 -0.32879 0.097779 0.0087605 0.0032189 -0.00017481
-0.00063785 -0.0091863 -0.027288 -0.32879 2.228 0.32891 0.026749 0.0097507 -0.00050801
0.00021827 0.0029886 0.008956 0.097779 0.32891 1.9732 0.31834 0.12593 -0.009454
9.5127e-06 0.00017938 0.00051137 0.0087605 0.026749 0.31834 1.7798 0.31831 -0.025872
3.2487e-06 6.3108e-05 0.00017922 0.0032189 0.0097507 0.12593 0.31831 1.9715 -0.30885
-1.0862e-07 -2.6465e-06 -7.3213e-06 -0.00017481 -0.00050801 -0.009454 -0.025872 -0.30885 1.7534
I got the following error
Error in expm
if ~all(isfinite(A),'all')
Steven Lord
Steven Lord le 22 Juin 2020
That doesn't look like the full error message. Can you post all the text displayed in red (and if there was any text displayed in orange, post that too) when you call expm?
I try to run it in the command window and just got the following
Attempt to execute SCRIPT all as a function:
/Users/jga/Documents/MATLAB/all.m
Error in expm (line 30)
if ~all(isfinite(A),'all')
Omar B.
Omar B. le 22 Juin 2020
Walter Roberson
Walter Roberson le 22 Juin 2020
Having that error message earlier would have helped a lot.

Connectez-vous pour commenter.

 Réponse acceptée

Steven Lord
Steven Lord le 22 Juin 2020

1 vote

You've written your own script all.m that's being called instead of the all function built into MATLAB. Rename or remove your file /Users/jga/Documents/MATLAB/all.m so MATLAB can call the built-in function.

2 commentaires

Omar B.
Omar B. le 22 Juin 2020
Thank you so much.
madhan ravi
madhan ravi le 22 Juin 2020
xD

Connectez-vous pour commenter.

Plus de réponses (1)

madhan ravi
madhan ravi le 21 Juin 2020
clear expm

7 commentaires

Momo
Momo le 21 Juin 2020
still not working.
which expm -all % try this in command window and paste your output
/MATLAB/toolbox/matlab/matfun/expm.m
/MATLAB/toolbox/symbolic/symbolic/@sym/expm.m % sym method
/MATLAB/toolbox/parallel/gpu/@gpuArray/expm.m % gpuArray method
madhan ravi
madhan ravi le 21 Juin 2020
Modifié(e) : madhan ravi le 21 Juin 2020
By the way are you different person? Because the person has a different name. By the way show the full error message with how you’re calling it.
I could not access my account so my frind helped me. Sorry abou that.
which expm -all % try this in command window and paste your output
/MATLAB/toolbox/matlab/matfun/expm.m
/MATLAB/toolbox/symbolic/symbolic/@sym/expm.m % sym method
/MATLAB/toolbox/parallel/gpu/@gpuArray/expm.m % gpuArray method
/Applications/MATLAB_R2020a.app/toolbox/matlab/matfun/expm.m
/Applications/MATLAB_R2020a.app/toolbox/symbolic/symbolic/@sym/expm.m % sym method
/MATLAB/toolbox/matlab/matfun/expm.m
Error: Invalid use of operator.
Omar B.
Omar B. le 21 Juin 2020
Modifié(e) : Omar B. le 21 Juin 2020
I posted the full error message I have gotten.
Walter Roberson
Walter Roberson le 22 Juin 2020
In MATLAB, when an error occurs, you are given an indication of which routine the error occurred in.
When the error occurs in a built-in function or a .p function or inside Simulink, then the error message just tells you which function the problem occurred in, and in that case always excludes the line of code that triggered the error.
When the error occurs in .m code, then (except for some cases involving caught errors that are re-thrown) the error always includes the line of code that the problem occurred on and includes an indication showing the line number in the code.
You show us a line of code that apparently triggered the error. In such a case, you would have been told the line number of the error. But you claim that you have shown us the entire error message.
Either you are mistaken about what you posting being the entire error message, or else your MATLAB is badly corrupted and needs to be reinstalled.
Omar B.
Omar B. le 22 Juin 2020
I understand, it was working before I update Matlab from 2017 to 2020. I do not know where is the problem.

Connectez-vous pour commenter.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by