Error using str2sym (line 213)

조회 수: 1 (최근 30일)
Tiasa Ghosh
Tiasa Ghosh 2018년 8월 29일
댓글: madhan ravi 2018년 8월 30일
Hello!
I receive an error while running the following section:
syms V I R fR L dI Ka I w
str2sym('V == I*(R+fR) + L*dI + Ka*I*w')
I get the error
Error using str2sym (line 213)
Unable to convert string to symbolic expression:
Error: Unexpected MATLAB expression.
After looking inside the error with dbstop if error, I found the variable 'I' is treated as special character. why so?
  댓글 수: 3
Tiasa Ghosh
Tiasa Ghosh 2018년 8월 30일
I am using a MATLAB toolbox which take symbolic equations as input. I have the equations as strings in a cell array and using a loop I need to use str2sym.
madhan ravi
madhan ravi 2018년 8월 30일
Cool good that you found an answer.:)

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

채택된 답변

Walter Roberson
Walter Roberson 2018년 8월 29일
This is a bug involving use of the variables I or J or 'Pi' or 'PI' or 'pI'. Also, you cannot use if in an expression, and i and j will be translated into 1i .
Those are the only one-character and two-character variable names that are affected.
  댓글 수: 1
Tiasa Ghosh
Tiasa Ghosh 2018년 8월 30일
Thanks! :) I will keep these in mind.

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by