How to hold more than 2 plots in one figure?
6 views (last 30 days)
Show older comments
the hold function works just for overlapping two plots! I want to draw more than two plots in a figure. (not by subplotting)! My code is:
clc
clear
lambda = 10;
A = 1;
V = 1000;
x = -200:lambda/100:200;
t = 1;
k = 2*pi/lambda;
u = -0.423 * k * A * sin(k*(x-V*t));
w = +0.620 * k * A * cos(k*(x-V*t));
%here is the 1st plot :
_*plot(u,w);*_
axis equal
hold on
for i=1:length(u)
%here is the 2nd plot :
*_plot(u(i),w(i),'or')_*
drawnow
pause(.1)
end
hold on
%here is the 3rd plot :
*_plot(x+u,w)_*
end
The Matlab's output for this code, doesn't plot the 3rd plot! I want to have all these plots, in one figure. on the same axis!
Thanks for your time!
0 Comments
Answers (1)
Walter Roberson
on 12 Mar 2013
You can "hold on" as many plots as you like (within the memory limits of your system.)
You do not need "hold on" for each plot.
Note that your third plot is the same as your first plot, but shifted along the x axis.
0 Comments
See Also
Categories
Find more on Graphics Performance 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!