## Waveform averaging - the PicoScope way

Forum for discussing PicoScope version 6 (non-automotive version)
Pico Stuart
Site Admin
Posts: 75
Joined: Tue Jun 30, 2009 3:08 pm

### Waveform averaging - the PicoScope way

PicoScope 6 has a wealth of features available at your fingertips including some really excellent advanced maths channels.

Advanced Maths Channels

This feature can be found by going into Tools->Maths Channels, then clicking “Create”, and the “Maths Channel Wizard” will appear.

• Clicking Next will allow the user to enter basic equations.
Maths Channel Wizard
• Clicking the Advanced button will reveal further buttons.
Advanced Math Channel Wizard
• The min, max, x - bar *(average) and peak (also known as envelope) works on multiple waveforms/buffers. Here, x - bar is chosen on channel A.

*
* Average Symbol
average.png (2.77 KiB) Viewed 18886 times
• After clicking Next, the channel name and colour can be defined.
Channel name and colour selection
• After clicking on Next, the units and range can be defined. The range can be left to be automatic or it can be customised by selecting the tick box.
Range and Units for your Maths Channel
• The next screen that appears summarises the actions taken. The Finish button has to be selected at this stage to save the settings unless further editing is required.
Creation Process Complete
• When finished, the newly created Maths channel appears in the Library and can be enabled by clicking the tick box and then selecting OK:
Library
Library.jpg (22.89 KiB) Viewed 18886 times
• The signal below shows a very noisy sinewave. PicoScope averages the signal over a number of buffers and cleans up the signal dramatically.
Sinewave
• The image below shows the peak (also called envelope) taken from a signal that is sweeping up and down in frequency. This takes the min and max pairs and draws a line between them. The peak measurement is the same as drawing a line between the min and max measurements. This mode is useful for analysing jitter on a signal.
Multiple views
Have fun and as always we are here to help.

Kindest regards,

Stuart
Applications Engineer

F4CTZ
Newbie
Posts: 0
Joined: Fri Sep 25, 2015 4:48 pm

### Re: Waveform averaging - the PicoScope way

Hello,

I'm currently using a 5244B and the averaging function would be very very helpful if I can use it on the FFT.

Indeed, the averaging would help me lowering the noise floor of the picoscope.

Is it possible in the actual version. If yes, how to do it because I'm unable to see spectrum from a mathematical channel like Average(A).

Thanks for the help,
Best Regards,
Fabien.

Martyn
Site Admin
Posts: 3723
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

### Re: Waveform averaging - the PicoScope way

Not sure if this approach would help but may be worth trying.

Set the scope running in time domain, at 200ms/div, then right click on the display and select AddView, and chose spectrum. You will now have a second view of the data in a frequency domain plot, but using the time domain data.

The time domain window is controlling the data collection, so if you now if you click on the time domain window, so that it has focus, and then use the Channel Settings, you have the option to add Resolution Enhancement which will help to reduce the noise floor. The spectrum window is calculated on the collected data so this will also reflect the reduced noise floor.

You may need to play around with the timebase and number of samples to get the correct spectrum range, as well as Tools->Preferences->Sampling to change the transition time so that data is collected in block mode, not streaming.
Martyn
Technical Support Manager

jcapek
Newbie
Posts: 0
Joined: Tue Nov 10, 2015 4:56 pm

### Re: Waveform averaging - the PicoScope way

Hello,

I am trying to set the averaging function of waveforms by following the instructions here. The resulting waveform is really nicely smoothed, but it seems the level of averaging is independent of the number of samples in the buffer. Even if I set only one picture in the buffer, the resulting curve is nicely smoothed.

I need a possibility to set the number of waveforms for averaging. Is there any way to do this?

Thank you very much for your help.

Jiri
(Picoscope 6403C)

Martyn
Site Admin
Posts: 3723
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

### Re: Waveform averaging - the PicoScope way

When using the Maths Channel Average it performs a continuous running average, including the waveforms that have been overwritten by newer ones, not a running average of the waveforms in the buffer. This additional functionality has been requested of the development team although not currently added into the software.

There is a workaround by trying Tools->Alarms, changing from Capture to BuffersFull, then adding a new alarm action to Stop Capture.

When you run the scope it will now stop once the buffers are full, and the Maths Channel average will be for the stored buffers.
Martyn
Technical Support Manager

jdepalma
Newbie
Posts: 0
Joined: Thu Jan 07, 2016 4:46 pm

### Re: Waveform averaging - the PicoScope way

Hi Martyn,

I have as question about saving the average waveform. I followed the above instructions for the work around to stop collecting after the buffers were full - I set it to collect 128 scans in the buffer. I am relatively new to Pico. I went to try and save the average, and when I did, I did not realize that it was saving 128 different files!

Is it possible to only save the 128-scan average as a single file? Or, how do I average all the files together? Thanks in advance.

Martyn
Site Admin
Posts: 3723
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

### Re: Waveform averaging - the PicoScope way

Use Save Current Buffer, which will just save the last one.
Martyn
Technical Support Manager

jdepalma
Newbie
Posts: 0
Joined: Thu Jan 07, 2016 4:46 pm

### Re: Waveform averaging - the PicoScope way

Hi Martyn,

Thanks for the tip! I have another question for you about averaging.

The physical oscilloscope attached to my instrument has the option to run in sample mode OR run in average mode, where I can take the summed average of 4, 16, 64 or 128 individual shots to make nice looking spectra. In other words, if I set oscilloscope to average four acquisitions, then it will average each new acquisition into the total average displayed on the screen, as it is acquired. When it gets the fifth acquisition, it discards the average information created by the first acquisition, and adds the fifth to the total average. When you get the sixth acquisition, it discards the second and adds the sixth, and so on. Is this possible in the your software? I tried to figure it out (and do did my boss) but we were unable to figure it out. Is this possible?

In additionally, I am currently writing LabView software to take the same spectra I described above. I have written a VI that can read the 5444A's output in real time, display a live waveform, and then average as many spectra as I desire. This is OK, but I am looking to do the same binned continuous averaging I described above. Do you have any sub-VI's which do this, or could you point me in the correct direction?

Any help is appreciated. Thanks.

Martyn
Site Admin
Posts: 3723
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

### Re: Waveform averaging - the PicoScope way

The rolling average of the waveform buffers, discarding the oldest and adding the newest,is a feature request for our PicoScope software already, although I have no timescales as to when/if this will be implemented.

We don't have any Vi's that will do this, I would look to have a rolling set of buffers that you load the live data in to, and then average these. In this way you can initiate the collection of new data to the live running buffer whilst performing the averaging of the last x buffers.
Martyn
Technical Support Manager

MalcolmCaemmerer
Newbie
Posts: 0
Joined: Wed May 03, 2017 7:37 am

### Re: Waveform averaging - the PicoScope way

Hi Martyn,

Has this rolling average function been implemented yet?

Thanks, Malcolm

Martyn
Site Admin
Posts: 3723
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

### Re: Waveform averaging - the PicoScope way

Not yet as it is being considered with a number of other buffer related maths suggestions
Martyn
Technical Support Manager

MalcolmCaemmerer
Newbie
Posts: 0
Joined: Wed May 03, 2017 7:37 am

### Re: Waveform averaging - the PicoScope way

Thanks for the update, Martyn

Grizzle
Newbie
Posts: 0
Joined: Thu Jul 13, 2017 9:04 pm

### Re: Waveform averaging - the PicoScope way

So I think it's great that you can average for more than the number of waveforms in your buffer. However I can't figure out how to save that average. When I save the waveform it saves each waveform in the buffer, along with the average of those waveforms. But not the average of the all the captures as it does on the scope.

ie.
I capture 100 waveforms, that in the scope are all averaged. The 15 most recent captures are buffered. When I save the waveforms (by the way I'm saving in the matlab format) I now have 15 files that each contain the data for a waveform form the buffer, along with the average of only the 15 waveforms that were in the buffer, and NO average waveform that is made up of the 100 captured waveforms.

Is there a way to save the average of all 100 captures?

Thanks,

Grant

Martyn
Site Admin
Posts: 3723
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

### Re: Waveform averaging - the PicoScope way

Not at the present time and it would require a significant rewrite to achieve this.
Martyn
Technical Support Manager

Niall
Newbie
Posts: 0
Joined: Fri Jun 23, 2017 10:12 am

### Re: Waveform averaging - the PicoScope way

Regarding 'averaging', or 'smooting', I have managed to get my 3404MSO to 'smooth' a channel by modifying the 'Resolution Enhancement' to 'greater than' 8-bits.

This is fine if you are only working in Single-Shot capture mode, and are willing to wait until the end of a capture before the smoothing takes place.

However - unlike just about every other digital scope (and even a few analogue instruments as well) - there does not seem to be any way to 'smooth' the captured data 'live' (i.e. during the capture scan itself).

Is this possible? If so, how can I implement this?

If it is not possible, why not? Surely it cannot be beyond the capability of the PicoScope Software Development Team to add a simple 'Kalman Filter' to the digitised samples, just before they are plotted on-screen.

I have been doing this for over 35 years - so it's nothing new! I attach code from a current project that shows how I have most recently implemented this in an Embedded Microcontroller environment:

Code: Select all

``````// get an ADC conversion, and smooth it using a Kalman filter:
/* pseudocode:-
X[n]    = (K.Z[n]) + ((1 - K).X[n-1])		, or
X[n]    = ((Z[n]) + ((F - 1).X[n-1])) / F	, where
X[n]    = new result
x[n-1]  = previous result
Z[n]    = current new value
K       = Kalman gain factor (0 < K <= 1)
F       = Kalman filter Factor (= 1/K, F >= 1)
note :    to avoid integer-rounding errors (usually rounded-down)
the best method is to add (0.5 x the denominator) to the
numerator, before performing the division. This then gives
a result that is rounded to the nearest integer. This method
works most efficiently when F is an integer-power-of 2 :-
X[n]    = ((Z[n]) + ((F - 1).X[n-1]) + (F / 2)) / F
*/
``````
Cheers, Niall Saunders
3404MSO