%% Specify Hold State for Specific Axes
% Create a figure with two subplots and assign the Axes objects to the variables ax1 and ax2. Add a line plot to each subplot. Then add a second line plot to the upper subplot.

ax1 = subplot(2,1,1);
x = linspace(0,10);
y1 = sin(x);
plot(ax1,x,y1)

ax2 = subplot(2,1,2);
y2 = cos(x);
plot(ax2,x,y2)

%

hold(ax1,'on')
y3 = sin(2*x);
plot(ax1,x,y3)
hold(ax1,'off')

% Copyright 2015 The MathWorks, Inc.