Reputation: 193
When I run my program, the result are shown in a figure.
Now, when I want to plot each of my parameters available in the workspace, I have to close the previous figure, so that the new one can be opened!
Is there any way that I could plot new figures without closing the existed one?
Upvotes: 0
Views: 83
Reputation: 36
You can open up new figures using the figure command, like so:
t = 1:100;
y = sin(t);
figure
plot(t,y)
You can also change the title bar of individual figures by including a number in parentheses after the command:
t = 1:100;
y1 = sin(t);
y2 = sin(0.5.*t);
figure(1) % Title bar here will show "Figure 1"
plot(t,y1)
figure(2) % Title bar here will show "Figure 2"
plot(t,y2)
Upvotes: 1
Reputation: 38042
You can select multiple variables, and right click -> plot as multiple series.
But if you want separate figures, just issue a figure
command prior to plotting:
x = linspace(0, 2*pi, 100);
figure
plot(x,sin(x),'b', x,cos(x),'r')
title('sine & cosine')
figure
plot(x,tan(x),'b')
title('tangent')
Upvotes: 2