Why aren't the first and last peaks detected using findpeaks()?
古いコメントを表示
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!
採用された回答
その他の回答 (1 件)
Image Analyst
2022 年 10 月 30 日
0 投票
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.
カテゴリ
ヘルプ センター および File Exchange で Descriptive Statistics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

