About expm function error

Can someone help me?
I am trying to use expm function in matlab to do some calculation. However, everytime I use the expm() function, the system give me an error.
I want to use expm(M) not exp(M).
syms a b x;
H=[a*b,x;a,x-b];
M=int(H,x);
M
expm(M)

1 个评论

the error code from the matlab(I don't know how to fix it, please help me!)
Error using sym/subsindex (line 864)
Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must be
symbolic variables, and function body must be sym expression.
Error in sym/subsref (line 909)
R_tilde = builtin('subsref',L_tilde,Idx);
Error in untitled (line 5)
expm(M)

请先登录,再进行评论。

 采纳的回答

Walter Roberson
Walter Roberson 2022-2-3

1 个投票

You have a leftover variable in your workspace that is named expm so MATLAB thinks that you are indexing.

5 个评论

I checked my variable in my workspace, there is no leftover varibale named expm.
Is there possible M1 chip not compatible to 2019b version?
R2019b was not supported on the M1.
Thank you, I think that could be the reason why it gave me an error.
Solved the issue by resigned in my account...

请先登录,再进行评论。

更多回答(1 个)

I do not get an error when I run the code.
syms a b x;
H=[a*b,x;a,x-b];
M=int(H,x);
M
M = 
expm(M)
ans = 
See above.

3 个评论

Is there possible M1 chip not compatible to 2019b version?
The code you posted ran fine, without error, in 2018b and 2021a versions. I don;t have 2019.
thank you so much, I solved issue by resign in my account.

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Programming 的更多信息

产品

版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by