Why aren't the first and last peaks detected using findpeaks()?
Ältere Kommentare anzeigen
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!
Akzeptierte Antwort
Weitere Antworten (1)
Image Analyst
am 30 Okt. 2022
0 Stimmen
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 Kommentar
FsC
am 30 Okt. 2022
Kategorien
Mehr zu Descriptive Statistics finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

