%% Create Multiple Lines with Labels
% Define a set of x and y vectors and plot them. Then pad the y-axis with extra space above and below the maximum and minimum plotted values.

x = 0:0.1:60;
y = 4.*cos(x)./(x+2);
plot(x,y)
ylim padded

%
% Find the maximum and minimum values of y. Create horizontal lines at those locations with the labels 'Max' and 'Min'.

ymax = max(y);
ymin = min(y);
yline([ymax ymin],'--',{'Max','Min'})

% Copyright 2020 The MathWorks, Inc.