01-31-2006 09:17 PM
02-01-2006 02:26 AM
04-13-2010 01:21 PM
I re-invented this wheel. Mine only works on an array as a whole, and gives a centered moving average output. By centered, I mean that A[i] out = average(A[i - N/2], A[i - N/2 + 1], ... , A[i + N/2 - 1], A[i + N/2]), where N is the number of points to average. I couldn't figure out how to make the Express VI change its value of N programatically, so I'm using this one I wrote.
Labview 8.5
12-09-2010 06:12 AM
I used NI's "Mean PtByPt.vi" for this purpose, but like all the other solutions you have to split multichannel data and you need an instance of the VI for every channel. You cannot use a For Loop for reentrant VIs, so the diagram will expand for every additional channel. I took the "N_Point_Running_AverageMOD.vi" and modified it to handle arrays of input data. So one single VI for all channels. I considered adapting "Mean PtByPt" to using arrays but found out that NI does the calculation of the mean value inside the VI without using "Mean.vi". Maybe it is a bit more effective this way. But to adapt to other functions like e.g.. Standard deviation it would be necessary to edit the corresponding PtByPt VI, while with the attached VI you only have to change to the correspondent VI from the Statistics palette.
12-09-2010 10:34 AM
Here is a vi that implements a number of smoothing options, moving average being one of them. A lossy queue is used to store the data.
12-09-2010 06:30 PM
My jaw almost dropped to the ground when I saw Nickerbocker ask the question "How do I create an n-point running average VI?" What?! I've learned some really cool stuff from this guy in the past two years! What's he doing asking questions like this?!
Then I saw the original date. Sometimes necroposting is funny.
03-21-2017 10:59 AM
Since one of my ancient posts above got kudoed recently, I want to make sure to mention that for a simple running average, the array does not need to be rotated. All we need is replace the oldest element in the fixed-size buffer. See also other, even more efficient alternatives mentioned in my presentation.
An "average" does not care about the order of elements, but other ptbypt algorithms of course might.