Filtering peaks to find number of pulses
8 ビュー (過去 30 日間)
古いコメントを表示
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/150316/image.png)
0 件のコメント
回答 (3 件)
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.
0 件のコメント
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
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
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
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
%falling edge
% first Invert the signal like this
dataRev = data(end:-1:1);
% get the right indexes
FallingEdgeIndx = FallingEdgeIndx(end:-1:1);
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!