在有开放图形时画一条曲线



当我运行程序时,结果显示在图中。

现在,当我想绘制工作空间中可用的每个参数时,我必须关闭前一个图,以便打开新的图!

有没有办法在不关闭现有图形的情况下绘制新的图形?

可以选择多个变量,并右键单击->绘制为多个序列。

但是如果您想要单独的图形,只需在绘制之前发出figure命令:

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')

您可以使用figure命令打开新的图形,如下所示:

t = 1:100;
y = sin(t);
figure
plot(t,y) 

您还可以通过在命令后的括号中包含一个数字来更改单个图形的标题栏:

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)

最新更新