%% Separated Minima
% Compute the local minima of a vector of data relative to the time stamps in the vector t. Use the 'MinSeparation' parameter to compute minima that are at least 45 minutes apart.

t = hours(linspace(0,3,15));
A = [2 4 6 4 3 7 5 6 5 10 4 -1 -3 -2 0];
TF = islocalmin(A,'MinSeparation',minutes(45),'SamplePoints',t);
plot(t,A,t(TF),A(TF),'r*')

% Copyright 2012 The MathWorks, Inc.