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

    %% Axes Handles  
% Specify the axes for a 3-D stem plot. 

% Copyright 2015 The MathWorks, Inc.


%% 
% Define vectors |X|, |Y| and |Z|. 
X = linspace(-2,2,50);
Y = X.^3;
Z = exp(X); 

%% 
% Create a figure with two subplots and return the handles to each axes, |s(1)| and |s(2)|. 
% Plot a 3-D stem plot in the lower subplot by referring to its axes handle, |s(2)|.
% For comparison, plot a 2-D
% stem plot in the upper subplot by referring to its axes handle, |s(1)|. 

figure
s(1) = subplot(2,1,1);
s(2) = subplot(2,1,2);  

stem(s(1),X,Z)
stem3(s(2),X,Y,Z)