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

    %% Add Plot to Existing Graph
% Plot the sine function. Then, set the hold state to |on| to retain the
% current graph and add a cosine plot.

% Copyright 2015 The MathWorks, Inc.


%%
x = -pi:pi/20:pi;
y1 = sin(x);
y2 = cos(x);

plot(x,y1)
hold on
plot(x,y2)
hold off % reset hold state