MinPeakDistance ignoring some peaks it shouldn't

10 visualizaciones (últimos 30 días)
Ida Ekmark
Ida Ekmark el 5 de Oct. de 2019
Comentada: Ida Ekmark el 5 de Oct. de 2019
Hello,
I'm writing a code using findpeaks where I only want to find peaks within a certain intervall of each other. I thought MinPeakDistance would work, but it did not. When I'm not using MinPeakDifference I get the followng locs (x-values of the peaks);
1.0300 1.3000 1.5900 1.8700 2.1400 2.4100 2.7000 2.9700
, but when I use MinPeakDistance set to 0.3, both 1.87 and 2.14 dissapear. I want the array with MinPeakDistannce set to 0.3 to give the values;
1.0300 1.5900 2.1400 2.7000
, instead of
1.0300 1.5900 2.4100 2.9700
. Can anyone help me?
Thank you in advance

Respuesta aceptada

dpb
dpb el 5 de Oct. de 2019
See <Answers 482540: Logic of findpeaks> for what's behind the cause for this.
You'll have to modify your search pattern to look based on position first rather than magnitude first in order to do this...whether you can "trick" findpeaks into returning only the ones you wish will be very data specific in the shape of the time series.
Without the underlying data, there's no way to tell for certain on the particular case other than to return all the peaks and then do the selection/rejection from those locations with the arbitrary selection of which is first to retain and then using the distances between subsequent locations sequentially rather than via the builtin distance parameter.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by