Find peaks in a certain time interval

14 visualizaciones (últimos 30 días)
Giorgia Fusaroli
Giorgia Fusaroli el 25 de Jun. de 2021
Comentada: dpb el 25 de Jun. de 2021
Hi everyone, i need your help :)
I have a real signal (called signal) with the relative time vector (called time) in which i have already found the major peaks:
M=max(signal);
[p,l]=findpeak(signal);
j = 1;
i = 1;
s = size(p,1);
for i = 1:s
if p(i) >= mn
peak (j) = p(i);
lock (j) = l(i);
j = j+1;
end
end
Now, i have to discharge the peaks which are detected in a distance lower than 0.5 s. and this point is where i have some issue, Because i don't know how to select the peaks starting by the location and the associate time.
I don't know if i am clear, if you need some more info im totally available, Someone can help me ?
  1 comentario
dpb
dpb el 25 de Jun. de 2021
Why don't you first investigate the various options available in findpeaks to screen peaks based on given criteria?
[p,l]=findpeaks(signal,t,'MinPeakDistance',0.5);
will not reutrn peaks within 500 msec of each other for you -- you must pass the time vector in the units in which the spacing distance is entered, here I assumed seconds.
Also, it is not good practice to use time as a variable; that aliases the builtin MATLAB time function; I used t above instead.
You'll want to plot the result and compare to ensure you're not filtering out those that you do want, but there's where I'd certainly suggest to start...
You may want to use other criteria instead or besides to refine the returned peaks before you begin writing searching code of your own...

Iniciar sesión para comentar.

Respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by