how to plot points in a loop?
显示 更早的评论
for x=1:10
a=2*x
b=3*x^2
plot(a,b)
end
But the figure cannot be plotted. What should i write for the codes?
1 个评论
Stephen23
2018-3-1
@Chen Ji: do you want the points to be joined by a line?
回答(1 个)
figure()
hold on
for ...
...
plot(a,b,'*')
end
But I would not recommend doing this: the simpler MATLAB solution would be to write vectorized code:
X = 1:10;
A = 2*X;
B = 3*X.^2;
plot(A,B,'-*')
类别
在 帮助中心 和 File Exchange 中查找有关 Frequency-Domain Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!