subplot(2,2,1)
x = linspace(0,10) ;
y1 = sin(x) ;
plot (x,y1)
title ('subplot 1 :sin(x)')
subplot(2,2,2)
y2 = sin(2*x) ;
plot(x,y2)
title ('subplot 2: sin(2x)')
subplot(2,2,3)
y3 = sin(3*x) ;
plot(x,y3)
title ('subplot 3:sin(3x)');
subplot(2,2,4)
y4 = sin(4*x);
plot(x,y4)
title('subplot 4 : sin(4x)')
subplot(2,2,1)
x = linspace(-3.8,3.8) ;
y_cos = cos(x);
plot (x, y_cos);
title('subplot 1 :cosine')
subplot(2,2,2)
y_poly = 1 - x.^2./2 + x.^4./24 ;
plot(x,y_poly,'g')%g means green
title ('subplot 2 : polynomial')
subplot(2,2,[3,4]);
plot(x,y_cos,'b',x,y_poly,'g');%b means blue
title('subplot 3 and 4 : both')
for k = 1 : 4
data = rand(1,10) ;
subplot (2, 2 ,k)
stem(data)
end
subplot (2,2,2,'replace')%将第二个子图去除
有关子图的subplot的一些使用方法