Can I Use MinPeakProminence and MinPeakDistance at the same time?

7 visualizzazioni (ultimi 30 giorni)
Hello,
I will need to find each peak (dip) from a data point. However, some of the peaks are very close to each other and in that case, I need just one peak instead of all. So I used 'MinPeakDistance' so that I can maintain a gap between two peaks. At the same time, I also need to use the 'MinPeakDProminence'. Can I use both at the same time? I used both but it looks it did not help. Still I can see two dips (first dip locations) very close to each other. In the attached figure, I tried to detect dip instead of peak.
[vl, vlocs]=findpeaks(-y2,'MinPeakProminence',2,'MinPeakDistance',0.5);
  1 Commento
Mathieu NOE
Mathieu NOE il 29 Set 2022
hello
can you share your data ?
maybe you simply need a bit of smoothing so that you get only one global dip
if that is a valid option, try with smoothdata

Accedi per commentare.

Risposte (1)

Eric Delgado
Eric Delgado il 29 Set 2022
Yeah, sure. It's possible. Take a look at documentation of findpeaks.
  • If you specify a location vector, x, then 'MinPeakWidth' must be expressed in terms of x.
  • If you specify a sample rate, Fs, then 'MinPeakWidth' must be expressed in units of time.
  • If you specify neither x nor Fs, then 'MinPeakWidth' must be expressed in units of samples.
% Instead of:
[vl, vlocs]=findpeaks(-y2, 'MinPeakProminence', 2, 'MinPeakDistance', 0.5);
% Do this:
[vl, vlocs]=findpeaks(-y2, x, 'MinPeakProminence', 2, 'MinPeakDistance', 0.5);

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by