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

    %% Create a Stairstep Plot using plot Function 
% Evaluate two cosine functions at 50 equally spaced values between 0 and
% $4\pi$ and create a stairstep plot using |plot|.   

% Copyright 2015 The MathWorks, Inc.


%%
X = linspace(0,4*pi,50)';
Y = [0.5*cos(X), 2*cos(X)];
[xb,yb] = stairs(X,Y); 

%%
% |stairs| returns two matrices of the same size, |xb| and |yb|, but no plot.   

%% 
% Use |plot| to create the stairstep plot with |xb| and |yb|. 
figure
plot(xb,yb)