How to do Downward peak detection?

3 visualizzazioni (ultimi 30 giorni)
JamJan
JamJan il 31 Lug 2019
Modificato: Jon il 1 Ago 2019
I have the following double A: attached
If we plot A (figure attached), we caan see a lot of peaks upside down. If you zoom in, for instance at indices 2500 to 3000 at the y-range of 1.5-3, you see a lot of deep down ward peaks. I want to isolate only the deepest peaks (with this I mean, not the small downward peaks next to it) throughout the whole array.
How to do this?
Thanks!

Risposte (1)

Jon
Jon il 31 Lug 2019
Modificato: Jon il 31 Lug 2019
You can use the MATLAB function islocalmin for example
idx = 1:length(A)
isMin = islocalmin(A);
plot(idx,A,idx(isMin),A(isMin),'o')
This will find all the local minima "downward peaks". If you want to eliminate the "small downward peaks next to it" you will need to formulate a more precise definition of what your criteria is for a significant peak.
You can probably use the MinProminence parameter to select the peaks that you want.
  2 Commenti
JamJan
JamJan il 1 Ago 2019
Thank you, but unfortunately I'm using Matlab 2017a at this moment. Is there another way?
Jon
Jon il 1 Ago 2019
Modificato: Jon il 1 Ago 2019
You can use this approach to find where sign of the local slope changes to locate the minimums
idA = 1:length(A)
dA = diff(A);
isMin = [false sign(dA(1:end-1))< 0 & sign(dA(2:end))>0 false];
plot(idA,A,idA(isMin),A(isMin),'o')
Also I assumed that you do not have the Signal Processing toolbox. If you did you could use the findpeaks function.
You will need to define exactly what your criteria is for eliminating any spurious minima, and then you should be able to program up some code to do that. MATLAB uses the concept of "prominence" which they explain (in terms of relative maxima) here https://www.mathworks.com/help/signal/ug/prominence.html
Note also that if you have an algorithm for finding relative maxima you can always invert (multiply by -1) your signal so that the relative minima become relative maxima.
Finally I noticed that there is an offering in the MATLAB FEX (file exchange) that may provide some help https://www.mathworks.com/matlabcentral/fileexchange/11755-peak-finding-and-measurement

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by