finding accurate number of peaks and eleminate unwanted peaks
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
HI
I'm trying to find peaks in this data :
the actual data has 10 peaks as shown in the image below (peaks are in rectangle)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/161929/image.jpeg)
. I applied sgf filter got the peaks below
order = 7;
framelen =15;
x=data;
lx = 34;
sgf = sgolayfilt(x,order,framelen);
plot(x);
hold on;
plot(sgf);
sgf=-sgf;
[pks_smoothed,locs_smoothed,widths_smoothed,proms_smoothed] = findpeaks(sgf,'MinPeakProminence',0.05);
pks_smoothed = -pks_smoothed;
plot(locs_smoothed,pks_smoothed,'g*');
text(locs_smoothed+.02,pks_smoothed,num2str((1:numel(pks_smoothed))'))
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/161930/image.jpeg)
it detects many unwanted peaks how can I find the required peaks accurately and get rid of unwanted peaks ?
1 Kommentar
Antworten (1)
Greg Dionne
am 20 Mär. 2017
Try:
findpeaks(sgf,'MinPeakProminence',1.2);
3 Kommentare
Greg Dionne
am 22 Mär. 2017
Bearbeitet: Greg Dionne
am 22 Mär. 2017
An alternative is to perhaps take the output of your widths_smoothed and prom_smoothed and come up with some heuristic that matches the most of the peaks you care about then filter out the rest based upon that somehow. Some of your peaks look kind of "flat". Maybe use a combination of medfilt1() and diff() to identify the edges.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!