www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/QuadrantofSubplotsExample.m

    %% Quadrant of Subplots  
% Create a figure divided into four subplots.   

% Copyright 2015 The MathWorks, Inc.


%% 
% Define the data. 
x = linspace(0,10);
y1 = sin(x);
y2 = sin(2*x);
y3 = sin(4*x);
y4 = sin(8*x);  

%% 
% Plot the four sine waves and title each subplot. 
figure
subplot(2,2,1)
plot(x,y1)
title('Subplot 1: sin(x)')

subplot(2,2,2)
plot(x,y2)
title('Subplot 2: sin(2x)')

subplot(2,2,3)
plot(x,y3)
title('Subplot 3: sin(4x)')

subplot(2,2,4)
plot(x,y4)
title('Subplot 4: sin(8x)')