Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Counting Pulses

Subject: Counting Pulses

From: Dave

Date: 27 Oct, 2008 18:23:02

Message: 1 of 2

I have data sets that have been recorded from an oscilloscope. Each data set contains approximately 150000 points that represent a number of pulses; let's say 30 pulses for example. The pulses are clearly visible on the scope and when the data is plotted with Matlab. However, due to noise in the lines and 8-bit resolution of the scope, there is some noise in the pulses. I have been able to clean up the waveform a little bit using downsampling and LOWESS smoothing, but there may still be more than one local maximum in a given pulse. I am trying to figure out a method of counting the number of pulses in a given waveform. A typical pulse will consist of 5000 points, and has a amplitude range of about 0 to 10. Are there any built-in tools that would allow me to do this in Matlab? Has anyone accomplished this with custom functions?

Thanks!

Subject: Counting Pulses

From: Thomas Clark

Date: 2 Nov, 2008 20:49:01

Message: 2 of 2

Dave,

What is the level of noise in the signal?
And do your pulses vary much in peak amplitude?
Do you need to do anything with your data other than count the pulses (i.e. find their position)?

The most basic approach (forgive me if you've already done this)

% Vector a contains your data
threshold = 5; % (or whatever)
b = a>threshold;

And then write a short bit of code to record where values in b are the same as their adjacent values. Where b(index) == 0 and b(index+1) == 1, index represents the position of the start of a pulse. Then simply count how many times that happens. Of course this isn't totally robust to noise close to the threshold.


If you have more problems than this, you could try a convolution approach to cleaning up the signal. Define an artificial series of data points that contains a typical pulse shape. Take an FFT of it, and of your original data.

Multiply the two outcomes of the FFTs (convolution) then do an inverse FFT of the output. What you get should be a dataset with things that 'look' like your pulses accuentuated, and other features (noise) suppressed.

Shout if you have questions about convolution, FFTs etc. You could do a similar thing using wavelet decomposition.

Best,

Tom Clark



"Dave " <dplescia@yahoo.com> wrote in message <ge50u6$8gv$1@fred.mathworks.com>...
> I have data sets that have been recorded from an oscilloscope. Each data set contains approximately 150000 points that represent a number of pulses; let's say 30 pulses for example. The pulses are clearly visible on the scope and when the data is plotted with Matlab. However, due to noise in the lines and 8-bit resolution of the scope, there is some noise in the pulses. I have been able to clean up the waveform a little bit using downsampling and LOWESS smoothing, but there may still be more than one local maximum in a given pulse. I am trying to figure out a method of counting the number of pulses in a given waveform. A typical pulse will consist of 5000 points, and has a amplitude range of about 0 to 10. Are there any built-in tools that would allow me to do this in Matlab? Has anyone accomplished this with custom functions?
>
> Thanks!

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us