MinPeakProminence error in findpeaks - detecting unwanted signal

7 vues (au cours des 30 derniers jours)
See Yoong Wong
See Yoong Wong le 10 Mai 2023
Commenté : Mathieu NOE le 12 Mai 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 commentaires
Mathieu NOE
Mathieu NOE le 10 Mai 2023
in other words , maybe there is better alternative (if I get what you're looking for)
See Yoong Wong
See Yoong Wong le 11 Mai 2023
Modifié(e) : See Yoong Wong le 11 Mai 2023
@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).

Connectez-vous pour commenter.

Réponse acceptée

Mathieu NOE
Mathieu NOE le 11 Mai 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 commentaires
See Yoong Wong
See Yoong Wong le 12 Mai 2023
Thank you very much for your help Mathieu!
Mathieu NOE
Mathieu NOE le 12 Mai 2023
as always, my pleasure !

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by