11-21-2010 05:22 AM
Hey, guys
I meet some problems when I desgin a data filter
something like when the measured value was 3,7,2,9,4,6......etc. What I wanna to display is the value of (3+7+2+9)/4, (7+2+9+4)/4, (2+9+4+6)/4.......etc
like calc an average value on every four numbers, then moved on, do that again
Hope anyone can give me some ideas to achieve this.
Solved! Go to Solution.
11-21-2010 11:29 AM
or
How to make the 1st, 2nd, 3rd and 4th value go into an array(size 4), then added them and divided by 4
Then, when the 5th value come into array, it will replace the 1st value and do the same function
when the 6th value come into array, it will replace the 2nd value and do the same function as well
And 7th will replace the 3rd value, 8th replace the 4th value....etc.
11-21-2010 07:53 PM
Look under the Signal Processing\Point by Point\Probability & Statistics PtByPt. There you will find a function which calculates a moving average for the last X samples fed into the function, where X is adjustable (you can set it to 4).
11-22-2010 08:30 AM
If you always want to average 4 points you can do it with a shift register expanded to 4 left terminals.
Lynn