Filtering peaks to find number of pulses

조회 수: 3 (최근 30일)
Yargo Duran Pacheco
Yargo Duran Pacheco 2015년 5월 19일
편집: Armindo 2019년 2월 21일
Greetings,
As shown in the image below, I am trying to filter these "false" peaks(get rid of the close ones, which have the same "height" as the previous one) and thus find the number of pulses. Looking over the Help section and this forum I couldn't find any questions exactly like this one.
I've used this command to plot this graphic: findpeaks(data,'MinPeakProminence',3);
Thanks in advance.

답변 (3개)

Greg Dionne
Greg Dionne 2016년 4월 4일
It looks like you are using FINDPEAKS to find the flat parts of pulses. This might not be the right approach, but in a pinch, you can simply add a very small number to the input to prevent equal-height peaks that all appear within the same range.
Something like:
findpeaks(data(:) + 0.001*(1:numel(data))','MinPeakProminence',3)
If you want the first peak of each range (rather than the last) you can do something like this:
findpeaks(data(:) - 0.001*(1:numel(data))','MinPeakProminence',3)
Since you have the Signal Processing Toolbox, have a look at pulsewidth() or midcross(). That might be more in line of what you wish to do.

Image Analyst
Image Analyst 2015년 5월 19일
편집: Image Analyst 2015년 5월 19일
Which of the two peaks do you want? Or do you want the average location? Can't you adjust the findpeaks() options to get rid of those? If not, find out when the peak locations are within some specified distance of each other and take either the first, second, or average index location instead of both of them. Attach your data if you want more help.
  댓글 수: 5
Joseph Cheng
Joseph Cheng 2015년 5월 19일
편집: Joseph Cheng 2015년 5월 19일
Additionally, i would recommend using a threshold and then using something like diff to discover the rising and falling edge positions to count the number of pulses. This would also help determine which points are noise spikes like the 1 point wide pulses. are they real pulses, part of either neighboring pulses but a drop in signal made it look like a pulse, or not even a pulse but a noise spike while the signal was low?
Image Analyst
Image Analyst 2015년 5월 19일
2 was the threshold. If some of the pulses might be isolated noise spikes, then you could use regionprops() to detect and eliminate any pulses that did not span the minimum required number of indexes, like for example the thin pulse where x is about 90.

댓글을 달려면 로그인하십시오.


Armindo
Armindo 2019년 2월 21일
편집: Armindo 2019년 2월 21일
rising and falling edge can be found like this:
%Get the rising edge, is given by default matlab function findpeaks like this:
% rising edge
[pks,RisingEdgeIndx] = findpeaks(data)
%falling edge
% first Invert the signal like this
dataRev = data(end:-1:1);
[pks,locs] = findpeaks(dataRev)
% get the right indexes
FallingEdgeIndx = length(data) - locs +1;
FallingEdgeIndx = FallingEdgeIndx(end:-1:1);

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by