Filtering peaks to find number of pulses
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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.
0 comentarios
Respuestas (3)
Greg Dionne
el 4 de Abr. de 2016
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.
0 comentarios
Image Analyst
el 19 de Mayo de 2015
Editada: Image Analyst
el 19 de Mayo de 2015
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 comentarios
Joseph Cheng
el 19 de Mayo de 2015
Editada: Joseph Cheng
el 19 de Mayo de 2015
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
el 19 de Mayo de 2015
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
el 21 de Feb. de 2019
Editada: Armindo
el 21 de Feb. de 2019
rising and falling edge can be found like this:
%Get the rising edge, is given by default matlab function findpeaks like this:
% rising edge
%falling edge
% first Invert the signal like this
dataRev = data(end:-1:1);
% get the right indexes
FallingEdgeIndx = FallingEdgeIndx(end:-1:1);
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!