Why is it wrong: e3=sym('si​n(x)^2+cos​(x)=0')

 채택된 답변

madhan ravi
madhan ravi 2019년 4월 22일
편집: madhan ravi 2019년 4월 22일

0 개 추천

sym('') was replaced by str2sym('') in latest versions and you seem to be using 2018b version
e3=str2sym('sin(x)^2+cos(x)=0')
% ^^^^^^^

댓글 수: 10

zhenyu zeng
zhenyu zeng 2019년 4월 22일
Why can not I input e3=sym('sin(x)^2+cos(x)=0')
madhan ravi
madhan ravi 2019년 4월 22일
See the reason in the edited answer.
zhenyu zeng
zhenyu zeng 2019년 4월 22일
But I can input sym('a') not need to input str2sym('a'). Why?
Read the the error message clearly MATLAB states it clearly already:
Error using sym>convertChar (line 1459)
Character vectors and strings in the first argument can only
specify a variable or number. To evaluate character vectors and
strings representing symbolic expressions, use 'str2sym'.
Error in sym>tomupad (line 1225)
S = convertChar(x);
Error in sym (line 214)
S.s = tomupad(x);
madhan ravi
madhan ravi 2019년 4월 22일
Post this information in the question you recently asked. This is completely irrelevant to this question.
zhenyu zeng
zhenyu zeng 2019년 4월 22일
>> clear
>> sym('a')
ans =
a
zhenyu zeng
zhenyu zeng 2019년 4월 22일
I can use sym('a'). Why can not I use sym('a+b')?
zhenyu zeng
zhenyu zeng 2019년 4월 22일
Why not use str2sym('a') instead of sym('a’)?
madhan ravi
madhan ravi 2019년 4월 22일
It only works for only a number or a variable. Read the documentations. Take MATLAB on-ramp course to learn the basics of MATLAB.

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

추가 답변 (1개)

KSSV
KSSV 2019년 4월 22일

0 개 추천

syms x
e3 = sin(x)^2+cos(x)==0

질문:

2019년 4월 22일

댓글:

2019년 4월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by