Why can't I plot a graph?

조회 수: 10 (최근 30일)
MH LEE
MH LEE 2013년 12월 1일
편집: Walter Roberson 2025년 3월 4일
%Hi guys. I am a noob here. I did Matlab and Simulink in Uni before but I am still a noob in it and hope to spent sometime to %learn Matlab. I just wanted to try plot an equation and my script is as follows:
syms x;
y = x^2 + 4*x + 4
plot (y)
%Answer:
>> pl1
y =
x^2 + 4*x + 4
Error using plot Conversion to double from sym is not possible.
Error in pl1 (line 5) plot (y)

채택된 답변

Wayne King
Wayne King 2013년 12월 1일
편집: Wayne King 2013년 12월 1일
Why do you need to plot this symbolically:
x = -2:0.01:2; % or whatever the range
y = x.^2 + 4*x + 4;
plot(x,y)
If you want to plot symbolically:
syms x;
ezplot(x^2+4*x+4,[-2 2])
  댓글 수: 4
MH LEE
MH LEE 2013년 12월 1일
Okay can can. Accepted your answers :D. than how come if dun put ez cannot plot the graph? Can i say as long anything i use symbolically, must put ez in front?
Johnathon
Johnathon 2025년 3월 4일
What do you do if matlab crashes when you try and plot a graph.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Conversion Between Symbolic and Numeric에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by