Why is my graph coming out blank when i try and plot this code?
显示 更早的评论
回答(2 个)
Brian Hart
2019-2-23
0 个投票
It's an error in your calcuation of y. Check the size and you'll see it's coming out as a scalar. Replace "/" with "./", since you want element-wise division.
Star Strider
2019-2-23
Because you are calculating a single point.
If you use element-wise division here (using ./ rather than /), you get the plot you expect:
x=[0.1:0.1:5];
y=(sin(x))./x;
figure(2)
grid on
plot(x,y)
类别
在 帮助中心 和 File Exchange 中查找有关 Graph and Network Algorithms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!