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

    %% Set _x_-Axis Limits for Specific Axes
% Create a figure with two subplots and plot the same data in each subplot.
% Set the _x_-axis limits for the bottom subplot.

% Copyright 2015 The MathWorks, Inc.


x = linspace(0,5,1000);
y = sin(100*x)./exp(x);
ax1 = subplot(2,1,1);
plot(x,y)

ax2 = subplot(2,1,2);
plot(x,y)
xlim(ax2,[0 1])