Peak Detection

It is often desirable to automatically detect peaks, particularly in a spectral envelope.

The peak is the location where the slope changes directions.

Figure 1: Peak Detection
\scalebox{0.7}{\includegraphics{eps/peaks.eps}}

% threshhold  
th = 0;                                     

% filter descending values
uslope = Ymag > [Ymag(1); Ymag(1:end-1)];

% filter ascending values
dslope = Ymag >= [Ymag(2:end); 1+Ymag(end)];

% only indeces at maxima retain non-zero value
Ymax = Ymag .* (Ymag > th) .* uslope .* dslope;

% peak indeces
maxixs = find(Ymax);


``Music 270a: Signal Analysis'' by Tamara Smyth, Department of Music, University of California, San Diego.
Download PDF version (analysis.pdf)
Download compressed PostScript version (analysis.ps.gz)
Download PDF `4 up' version (analysis_4up.pdf)
Download compressed PostScript `4 up' version (analysis_4up.ps.gz)

Copyright © 2019-12-02 by Tamara Smyth.
Please email errata, comments, and suggestions to Tamara Smyth<trsmyth@ucsd.edu>