如何在matlab中绘制不同的框架

时间:2012-08-29 11:50:59

标签: matlab

在我的计划中,我想得到三个图,

plot(CumulativeReward)
title('Cumulative Reward, gamma=1');
xlabel('episode number');
ylabel('CumulativeReward')

plot(Pathlength)
title('pathlength as a function of episode number');
xlabel('episode number');
ylabel('pathlength')

x = -pi:.1:pi;
y = sin(x);
plot(x,y)

但是所有三个图都在一个框架中,我如何将每个图放在不同的框架中?

1 个答案:

答案 0 :(得分:3)

在致电figure之前致电plot。这将打开一个新的数字窗口。

为了更容易区分窗口,您可以设置其标题,例如

figure('name','Cumulative Reward')

如果你想并排绘图,你可以使用subplot,即

subplot(1,3,1)
%# your first plot here
subplot(1,3,2)
%# your second plot here
subplot(1,3,3)
#% your third plot here