0

如何同时创建多个子图,例如,我有

while i < 4
   kS = kS_array(i);
   bS = bS_array(i);
   sim('sim_1');
   subplot(3,1,i), plot(time,x);
   %now i want to create another subplot for F(force wrt time)
   % something like subplot_2(3,1,i), plot(time, F)
   i=i+1;
end

我正在用不同的变量模拟 simulink 模型并绘制它们。我是初学者,所以我想知道是否有其他有效的方法可以做到这一点。

4

1 回答 1

0

找到了答案

figure1 = figure; figure2 = figure;
while i < 4
   kS = kS_array(i);
   bS = bS_array(i);
   sim('sim_1');
   set(0, 'currentfigure', figure1);
   subplot(3,1,i), plot(time,x);
   set(0, 'currentfigure', figure2);
   subplot(3,1,i), plot(time, FT);
   i=i+1;
end

这按我想要的方式工作。

于 2013-07-06T16:16:28.307 回答