How to detect peaks above a given threshold value?
Show older comments
findpeaks() can detect multiple peaks if there is/are change in direction(s) even if the values are above the specified threshold (see arrows in the attached pdf file).
J=a vector;
findpeaks(J,'MinPeakHeight',Threshold);hold on;
yline(Threshold,'--','LineWidth',3);
hold off

4 Comments
madhan ravi
on 20 Jul 2020
Is your threshold 20 ?
Sudip Paudel
on 20 Jul 2020
Edited: Sudip Paudel
on 20 Jul 2020
madhan ravi
on 20 Jul 2020
What happens when you change it to 20?
Sudip Paudel
on 20 Jul 2020
Accepted Answer
More Answers (1)
Image Analyst
on 20 Jul 2020
Edited: Image Analyst
on 20 Jul 2020
Try flattening the signal by subtracting that red trend line. Then set the values of the signal below the threshold to zero and then call findpeaks()
smoothedSignal = movmean(signal, 101);
flattenedSignal = signal - smoothedSignal;
flattenedSignal(flattenedSignal < someThreshold) = 0;
[peakValues, indexesOfPeaks] = findpeaks(flattenedSignal);
Attach your data in a .mat file if you need more help.

1 Comment
Sudip Paudel
on 22 Jul 2020
Categories
Find more on Descriptive Statistics in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!