How does FindPeaks works?

17 views (last 30 days)
Anatoly
Anatoly on 5 Nov 2020
Edited: dpb on 6 Nov 2020
Hello.
At least simplified, could you explain the algorithms used in the FindPeax function? Based on the zero crossing of the derivative?
Regards, Anatoly

Answers (1)

dpb
dpb on 5 Nov 2020
Edited: dpb on 6 Nov 2020
TMW doesn't reveal innards beyond what is in documentation so the answer is "we don't know".
What the documentation says is:
"findpeaks(data) returns a vector with the local maxima (peaks) of the input signal vector, data. A local peak is a data sample that is either larger than its two neighboring samples or is equal to Inf. Non-Inf signal endpoints are excluded. If a peak is flat, the function returns only the point with the lowest index."
How, specifically, the function determines that result isn't documented. However, it is (at least still in R2019b) an m-file and you can read the code to see...
findLocalMaxima(), in fact, does precisely that in looking for and finding local minima. It is, however, as it says, solely a point-by-point comparison, no fancy gradient calculation or smoothing or anything exotic.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!