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

    %% Plot Single Data Series at Specified x values  
% Plot 50 data values of cosine evaluated between 0 and $2\pi$ and specify the
% set of _x_ values for the stem plot.   

% Copyright 2015 The MathWorks, Inc.


%%  
figure
X = linspace(0,2*pi,50)';
Y = cos(X);
stem(X,Y)    

%%
% The first vector input determines the position of each stem on the _x_-axis.