%% Constrain Peak Features
% Load an audio signal sampled at 7418 Hz. Select 200 samples.

load mtlb
select = mtlb(1001:1200);

%
% Find the peaks that are separated by at least 5 ms.
% To apply this constraint, findpeaks chooses the tallest peak in the signal and eliminates all peaks within 5 ms of it. The function then repeats the procedure for the tallest remaining peak and iterates until it runs out of peaks to consider.

findpeaks(select,Fs,'MinPeakDistance',0.005)

%
% Find the peaks that have an amplitude of at least 1 V.

findpeaks(select,Fs,'MinPeakHeight',1)

%
% Find the peaks that are at least 1 V higher than their neighboring samples.

findpeaks(select,Fs,'Threshold',1)

%
% Find the peaks that drop at least 1 V on either side before the signal attains a higher value.

findpeaks(select,Fs,'MinPeakProminence',1)

% Copyright 2015 The MathWorks, Inc.