%% Specify Hold State for Specific Axes
% Starting in R2019b, you can display a tiling of plots using the tiledlayout and nexttile functions. Call the tiledlayout function to create a 2-by-1 tiled chart layout. Call the nexttile function to create the axes objects ax1 and ax2. Plot a sine wave plot in each axes.

x = linspace(0,10);
y1 = sin(x);
y2 = cos(x);
tiledlayout(2,1)

% Top plot
ax1 = nexttile;
plot(ax1,x,y1)

% Bottom plot
ax2 = nexttile;
plot(ax2,x,y2)

%
% Add a second sine wave to the top axes.

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

% Copyright 2019 The MathWorks, Inc.