MinPeakProminence error in findpeaks - detecting unwanted signal
8 views (last 30 days)
Show older comments
See Yoong Wong
on 10 May 2023
Commented: Mathieu NOE
on 12 May 2023
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 Comments
Mathieu NOE
on 10 May 2023
in other words , maybe there is better alternative (if I get what you're looking for)
Accepted Answer
Mathieu NOE
on 11 May 2023
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 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!