LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

averaging SETS of waveform data

I have a triangular waveform that contains a signal, and I would like to average ~100 triangular portions in order to reduce noise and smooth out the signal. How can I save all of this data and average it before export to a spreadsheet file? I'd like a waveform chart that shows the acquired data (one triangular ramp) and clears between each iteration (I'm having trouble with programmatically clearing my charts, even though there's an example for this...), or something a bit like the "scanning chart with history" example. Maybe then I could average all of the matched-up points in 100 arrays? (I'll have 15,000 points per triangular scan) I just need a few pointers...
0 Kudos
Message 1 of 9
(3,700 Views)
You can use a waveform graph to display each set of data as it come in.

As long as each set of data has the same number of points, you can use the normal addition function to add them together on a point by point basis. Use shift registers in a loop to keep the sum each iteration and then divide by the total number of sets after you leave the loop.
Randall Pursley
0 Kudos
Message 2 of 9
(3,679 Views)

Unfortunately, this problem can be a lot more difficult that it sounds. There are two variations.


  1. Your acquisition rate is a multiple of the triangle rate frequency - This is the easy case. Use the Reshape Array primitive to change your array from a 1D to a 2D array, then average the different pieces of it using a FOR loop.

  2. Your acquisition rate is not a multiple of the triangle rate frequency - This is harder. Use the Basic Level Trigger Detection VI to find the start of all your sections, then a linear fit to find it to subsample resolution. The trigger location will need subsample resolution or you will smear your waveform when you average. Once you have found where all your sections start, cut the array apart into individual sections using the array functions, then use the Align and Resample Express VI to align all the points in the sections to be at the same times with respect to the start of the section. You may want to leave a few points at the ends of the pieces to allow the resampling to be done well. Trim them now if you do, then average.

This should get you on your way. You usually need to play around with this type of thing to get it right, especially the first time you try it. Good luck.

0 Kudos
Message 3 of 9
(3,677 Views)
Thanks for the replies - luckily, I do have the 'easy case' - I have collected a 2D array of the triangular sections of my waveform. I'm now trying to average the data. I thought I'd be able to use the sum function (like in the example from the discussion board below) but apparently I can't because I don't have a NUMERIC array. Any ideas? (I'm using LabVIEW 6i so I can't open the example that was posted here)
0 Kudos
Message 4 of 9
(3,648 Views)
sorry, this is what I was trying to do...
0 Kudos
Message 5 of 9
(3,648 Views)
Getting back to your original question, after you reshape the array, you sum the columns by adding the rows, vector-wise, in a FOR loop, then divide by the original number of rows. The attached code (LV 6.1) shows how to do the averaging using the array functions and array functionality of the add/divide primitives. This should work for any data type which can be added/divided (e.g. clusters of numbers).

If I misunderstood your problem, please repost and I'll try again.
0 Kudos
Message 6 of 9
(3,646 Views)
It looks like I've got version 6 (even though my shortcut says 6i) - I can't open the attachment
0 Kudos
Message 7 of 9
(3,645 Views)
Ah, the wonders of marketing... LabVIEW 6i is LabVIEW 6.0.x. The “i” stood for “internet”. Fortunately, the array functions I used were introduced in 6i, so you are OK. Try this VI.
0 Kudos
Message 8 of 9
(3,629 Views)

I forgot to mention. If your copy of LabVIEW 6i has not been updated to 6.0.2, I would strongly recommend you do so. There are some nasty bugs in the 6.0.0 and 6.0.1 versions. 

0 Kudos
Message 9 of 9
(3,625 Views)