MATLAB Answers

How to calculate expm of a matrix?

4 ビュー (過去 30 日間)
Omar B.
Omar B. 2020 年 6 月 21 日
コメント済み: madhan ravi 2020 年 6 月 22 日
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 件のコメント

表示 3 件の古いコメント
Omar B.
Omar B. 2020 年 6 月 22 日
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. 2020 年 6 月 22 日
Walter Roberson
Walter Roberson 2020 年 6 月 22 日
Having that error message earlier would have helped a lot.

サインインしてコメントする。

採用された回答

Steven Lord
Steven Lord 2020 年 6 月 22 日
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 件のコメント

Omar B.
Omar B. 2020 年 6 月 22 日
Thank you so much.
madhan ravi
madhan ravi 2020 年 6 月 22 日
xD

サインインしてコメントする。

その他の回答 (1 件)

madhan ravi
madhan ravi 2020 年 6 月 21 日
clear expm

  7 件のコメント

表示 4 件の古いコメント
Omar B.
Omar B. 2020 年 6 月 21 日
I posted the full error message I have gotten.
Walter Roberson
Walter Roberson 2020 年 6 月 22 日
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. 2020 年 6 月 22 日
I understand, it was working before I update Matlab from 2017 to 2020. I do not know where is the problem.

サインインしてコメントする。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by