Incorrect plot domain when using linspace

2 次查看(过去 30 天)
The plot generated by the following code should have a domain from 0 to 5 but instead each x value is multiplied by a factor of 20, for example, the y value at x = 100 (in the Matlab plot) is actually the y value at x = 5. I am using Matlab R2018a. Does anyone have suggestions as to how this problem can be fixed?
x = linspace(0,5);
y = 7/6*(x).^-1.*(x>0)-1.5*(x).^0.*(x>0) + 0.5*(x).^1.*(x>0);

采纳的回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2020-9-25
编辑:KALYAN ACHARJYA 2020-9-25
plot(x,y);
if
plot(y);
  1 个评论
Aleem Andrew
Aleem Andrew 2020-9-25
Thanks for your answer I thought maybe the domain was implicit in the y function

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by