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

    %% Set Axis Limits for Multiple Axes
% Create a figure with two subplots. Plot a sine wave in each subplot.
% Then, set the axis limits for the subplots to the same values. 

% Copyright 2015 The MathWorks, Inc.


x1 = linspace(0,10,100);
y1 = sin(x1);
ax1 = subplot(2,1,1);
plot(ax1,x1,y1)

x2 = linspace(0,5,100);
y2 = sin(x2);
ax2 = subplot(2,1,2);
plot(ax2,x2,y2)

axis([ax1 ax2],[0 10 -1 1])