%% Add Text to Multiple Data Points
% Plot a line. Add the same text to two points along the line.

% Copyright 2015 The MathWorks, Inc.


x = linspace(-5,5);
y = x.^3-12*x;
plot(x,y)

xt = [-2 2];
yt = [16 -16];
str = 'dy/dx = 0';
text(xt,yt,str)

%%
% Add different text to each point by specifying |str| as a cell array. 

x = linspace(-5,5);
y = x.^3-12*x;
plot(x,y)

xt = [-2 2];
yt = [16 -16];
str = {'local max','local min'};
text(xt,yt,str)