Why do I get a graph without a line when I try to plot the following equation?

x = -1:.1:4;
y = (41.7*x)/(x.^2+1);
plot(x,y)
I am not getting any error messages, all I see is a blank graph when I run the script.

 채택된 답변

It is not blank, as 51 small dots are plotted. Try this:
plot (x,y,'bo')
This is default behaviour for plot when y is a scalar. If you would have taken a look at x and y in your workspace, you would probably have spotted that. The reason for y being a scalar is addressed by dpb.

추가 답변 (1개)

Need the "dot" operator on the divide as well as the exponent...as is it's a matrix operator, not element-wise.
doc / % for details

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

질문:

2016년 2월 2일

답변:

2016년 2월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by