MinPeakProminence error in findpeaks - detecting unwanted signal

7 ビュー (過去 30 日間)
See Yoong Wong
See Yoong Wong 2023 年 5 月 10 日
コメント済み: Mathieu NOE 2023 年 5 月 12 日
I am trying to use the findpeaks function to look for sharp and intense peak in 100 spectra. Here is an example of my spectrum:
I tried different name-value arguments so that it would look for sharp and intense peaks only. However, it seems like the 'MinPeakProminence' is not working as expected.
When I apply the following line to the spectrum above (I limited the number of peaks (NPeaks) to 1 for simplier visualization) :
load ('Data.mat'); figure;
findpeaks(y, 'MinPeakProminence',0.15,'NPeaks',1,'MaxPeakWidth',20,'MinPeakDistance',7,'Annotate','extents');
This is what it gives me:
It seems like the function is drawing its own borders and using the boaders as lowest left and right intervals (This is just my observation, not sure if I intepreted that correctly).
Below shows the magnified detected "peak":
Has anyone encounter the same issue? Any help would be greatly appreciated.
Thanks in advance!
  5 件のコメント
Mathieu NOE
Mathieu NOE 2023 年 5 月 10 日
in other words , maybe there is better alternative (if I get what you're looking for)
See Yoong Wong
See Yoong Wong 2023 年 5 月 11 日
編集済み: See Yoong Wong 2023 年 5 月 11 日
@Mathieu NOE I see! I am looking for peaks like this one:
Peaks like this one might appear anywhere along the x-axis. They can have varied intensity (prominence between 0.1 to 0.95), but they should be sharp (width between 3 to 15 datapoints).

サインインしてコメントする。

採用された回答

Mathieu NOE
Mathieu NOE 2023 年 5 月 11 日
hello again
this would be my suggestion
hope it helps
load ('Data.mat');
[PKS,LOCS,W,P] = findpeaks(y, 'MinPeakProminence',0.15,'MaxPeakWidth',15,'MinPeakDistance',100);
% rejet peaks above 0.9 (the ones that could be on the y = 1 plateau)
id = (PKS<0.9);
PKS = PKS(id);
LOCS = LOCS(id);
W = W(id);
P = P(id);
% then select the first one (along the x axis)
PKS = PKS(1);
LOCS = LOCS(1);
W = W(1);
P = P(1);
figure;
plot(y); hold on
plot(LOCS,PKS,'dr');
  2 件のコメント
See Yoong Wong
See Yoong Wong 2023 年 5 月 12 日
Thank you very much for your help Mathieu!
Mathieu NOE
Mathieu NOE 2023 年 5 月 12 日
as always, my pleasure !

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by