3.1.2 子图
要将数个相关的图画在同一页时,可以用subplot这个指令。其语法为 subplot(m,n,p),其中 m, n代表绘图成 m x n 个子图,m表示在 y方向有 m 个图, n表示在 x 方向有 n 个图,p 是代表第几个子图。下例是以 subplot分别画 出线性及对数尺度的四个子图:
>> x=[0 2 5 7 10 12 15 17 20 21];
>> y=[0.1 0.2 0.5 0.6 0.9 1 1.2 1.26 1.22 1.2];
>> subplot(2,2,1), plot(x,y) % 画左上角的图
>> subplot(2,2,2), semilogx(x,y) % 画右上角的图
>> subplot(2,2,3), semilogy(x,y) % 画左下角的图
>> subplot(2,2,4),
loglog(x,y) % 画右下角的图



上一页 下一页 讲义大纲