Finding peaks in data based on certain threshold
Mostra commenti meno recenti
Hi I have an array [V Data] (Attached data file).The plot is shown below.

I want to detect the # of peaks (3 in this case) which are above a certain threshold (value is = 0.1) I also want to find the points where it crosses the threshold and extract respective values from V
Thanks SATEJ
Risposta accettata
Più risposte (1)
Image Analyst
il 20 Dic 2014
Describe what "detect" means to you. Obviously you threshold:
abovePointOne = v > 0.1;
but then what? What kind of numbers do you want? The length of the stretches above 0.1? The starting points? The count of the number of stretches above 0.1? What????
6 Commenti
Satej
il 20 Dic 2014
Modificato: Image Analyst
il 20 Dic 2014
Image Analyst
il 20 Dic 2014
It looks like Star's code gives you that plus even better in that it gives you sub-element resolution. If you need it on the exactly elements you said, then you'll have to do a more specialized, complicated routine. Probably a for loop where you're detecting if you're above the threshold and "in" the peak (in which case you'll keep the last index before you went above the threshold), or below the threshold but just went below it on this index (in which case you'll take that index instead of the prior one.)
Star Strider
il 20 Dic 2014
Thanks, I A.
To provide a context, I deleted my Answer because it was neither Accepted nor Voted.
Image Analyst
il 20 Dic 2014
Why bother to do that? It had good and clever code in it that may help someone else someday.
Satej
il 22 Dic 2014
Joshua Briggs
il 28 Mar 2017
Hi I am looking to do something similar to Satej, and IA's description of SS's code sounds like exactly what I need, just wondering if anyone has it, or if SS could please repost it.
Categorie
Scopri di più su Parametric Modeling in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!