About expm function error

조회 수: 6 (최근 30일)
ZHICHEN LIU
ZHICHEN LIU 2022년 2월 3일
댓글: ZHICHEN LIU 2022년 2월 3일
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
ZHICHEN LIU
ZHICHEN LIU 2022년 2월 3일
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일
You have a leftover variable in your workspace that is named expm so MATLAB thinks that you are indexing.
  댓글 수: 5
ZHICHEN LIU
ZHICHEN LIU 2022년 2월 3일
Thank you, I think that could be the reason why it gave me an error.
ZHICHEN LIU
ZHICHEN LIU 2022년 2월 3일
Solved the issue by resigned in my account...

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

추가 답변 (1개)

William Rose
William Rose 2022년 2월 3일
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
William Rose
William Rose 2022년 2월 3일
The code you posted ran fine, without error, in 2018b and 2021a versions. I don;t have 2019.
ZHICHEN LIU
ZHICHEN LIU 2022년 2월 3일
thank you so much, I solved issue by resign in my account.

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

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by