subplot(m,n,p)或者subplot(m n p)
subplot是將多個圖畫到一個平面上的工具。其中,m表示是圖排成m行,n表示圖排成n列,也就是整個figure中有n個圖是排成一行的,一共m行,如果第一個數(shù)字是2就是表示2行圖。p是指你現(xiàn)在要把曲線畫到figure中哪個圖上,最后一個如果是1表示是從左到右第一個位置。
下面是兩個例子,可加深理解,
>> t=0:0.001:1;
>> y1=sin(10*t);
>> y2=sin(15*t);
>> subplot(211)
>> plot(t,y1)
>> subplot(212)
>> plot(t,y2)
x1=[1 2 3];x2=x1;x3=x2;x4=x1;
y1=[2 4 6];y2=2*y1;y3=3*y1;y4=4*y1;
subplot(2,2,1)
plot(x1,y1);
axis([0,20,0,20])
subplot(2,2,2)
plot(x2,y2);
subplot(2,2,3)
plot(x3,y3)
plot(x4,y4)
axis([0,20,0,20])