Why aren't the first and last peaks detected using findpeaks()?
Mostrar comentarios más antiguos
I am using the findpeaks() function to detect any peaks in a vector that are greater than a defined threshold (>10% max peak).
I use the following find peaks code but find that the first or last peaks tend to be missed.
% find peaks in vec1 data using find peaks
thresh = .1 * max(dt);
[pks,vec1locs] = findpeaks(vec1, 'MinPeakProminence',thresh);
%plot vector and detected peaks
plot(vec1)
hold on
plot(vec1locs,pks,'or')
Below is the plot of the detected peaks and it didn't detect the last peak.

If I apply the same code with a different vector (vec2), it does not detect the first peak.

I've attached the data vectors if anyone would like to try. Are you seeing the same issue? Why is this happening and how can this be fixed?
Thank you!
Respuesta aceptada
Más respuestas (1)
Image Analyst
el 30 de Oct. de 2022
0 votos
Maybe because you don't have a point on the other side so it doesn't know if it's a peak or just a point on the side of a larger, missing peak.
1 comentario
FsC
el 30 de Oct. de 2022
Categorías
Más información sobre Descriptive Statistics en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

