Plot figures in loop as superimposed top on top
1 view (last 30 days)
Show older comments
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 Comments
Answers (1)
KSSV
on 19 Nov 2016
Edited: KSSV
on 19 Nov 2016
Used hold on after the plot inside loop.
5 Comments
Image Analyst
on 20 Nov 2016
Is x a vector or scalar? What is/are its value(s) exactly? Give code to generate x.
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!