%% Prominent Maxima
% Select maxima based on their prominence.
%
% Compute the local maxima of a vector of data and their prominence, and then plot them with the data.

x = 1:100;
A = peaks(100);
A = A(50,:);
[TF1,P] = islocalmax(A);
P(TF1)
plot(x,A,x(TF1),A(TF1),'r*')
axis tight

%
% Compute only the most prominent maximum in the data by specifying a minimum prominence requirement.

TF2 = islocalmax(A,'MinProminence',2);
plot(x,A,x(TF2),A(TF2),'r*')
axis tight

% Copyright 2012 The MathWorks, Inc.