Plot figures in loop as superimposed top on top
2 次查看(过去 30 天)
显示 更早的评论
Similar questions should have been asked however I couldn't get a solution.
Plot can superimpose these loop figures onto one another:
figure();
hold all
for i=1:2:11
y=i;
plot(x,y);
end
However, interestingly can't do the same here:
figure();
hold all
for i=1:2:11
y=x.^i;
plot(x,y);
end
What it does is plotting only the last figure. Any ideas why is this?
0 个评论
回答(1 个)
KSSV
2016-11-19
编辑:KSSV
2016-11-19
Used hold on after the plot inside loop.
5 个评论
Image Analyst
2016-11-20
Is x a vector or scalar? What is/are its value(s) exactly? Give code to generate x.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!