the use of ezplot function

조회 수: 2 (최근 30일)
metin yilmaz
metin yilmaz 2020년 11월 7일
댓글: Star Strider 2020년 11월 7일
Would you please explain the use of ezplot function. Why it is giving a warning in this case? Thanks
>> d
d =
'x^2 –6*x – 12'
>> ezplot(d)
Error using inlineeval (line 14)
Error in inline expression ==> x.^2 –6.*x – 12
Error: The input character is not valid in MATLAB statements or expressions.
Error in inline/feval (line 33)
INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr);
Error in ezplotfeval (line 51)
z = feval(f,x(1));
Error in ezplot>ezplot1 (line 482)
[y, f, loopflag] = ezplotfeval(f, x);
Error in ezplot (line 154)
[hp, cax] = ezplot1(cax, f{1}, vars, labels, args{:});

답변 (2개)

Star Strider
Star Strider 2020년 11월 7일
You need to use the (-) sign, not char(8211) for the minus sign.
Also, character arrays are no longer usable with the Symbolic Math Toolbox.
Try this instead:
syms x
d = x^2 - 6*x - 12;
figure
ezplot(d)
figure
fplot(d)
Bothe of these work with your function.
  댓글 수: 1
Star Strider
Star Strider 2020년 11월 7일
The ezplot and fplot functions are slightly diffrerent.
I want to introduce you to fplot because ezplot will likely be depricated (no longer supported) in the not distant future.

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


metin yilmaz
metin yilmaz 2020년 11월 7일
But what is the diffence between
syms x
d = x^2 - 6*x - 12;
figure
ezplot(d)
and
syms x
d = x^2 - 6*x - 12;
figure
ezplot(d)
figure
fplot(d)
?
Thank you.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by