iterative algorithm for calculating the moving average



Hi group, I have an interesting problem.
I would like to calculate the moving average of a time series at certain
intervals (for some variables I need a 1 hr average, and for others a 4 hr
average). I need this for quality control purposes at the plant I work. I
tried using the "standard" method (i.e. keep all the values in an array and
divide by the horizon), but this requires too much resources from the online
system (even when I use a "revolving" array and I have no FOR..NEXT loops).
I also tried approximating the moving average with a discrete exponential
filter of the form

average(t)=lambda*average(t-1) +(1-lambda)*x(t)

this last algorithm is fast, but when the signal is noisy, it does not work
very well. Also, it is always a lot of work to find the lambda that
approximates the moving average I want.

Any ideas? Does anyone have any algorithms or references on the above
subject?

Thanks!

Yannis


.



Relevant Pages

  • Re: Moving average filter ...
    ... - is this a valid moving average algortithm? ... - does this algorithm have a name? ... not an FIR. ... I like to think of these things as an approximate digital RC filter - they have a similar effect on the signals, and are just as easy to implement. ...
    (comp.arch.embedded)
  • Re: Moving average filter ...
    ... Algortihm is; ... - is this a valid moving average algortithm? ... - does this algorithm have a name? ... "Applied Control Theory for Embedded Systems" gives you just what it says. ...
    (comp.arch.embedded)
  • Re: Moving average filter ...
    ... This is not the same thing as the moving average, although it is certainly useful algorithm. ... void MovingAvg ... - is this a valid moving average algortithm? ...
    (comp.arch.embedded)
  • Re: Efficient Moving Average and Moving Variance Calculations
    ... efficient algorithm for computing a moving average. ... algorithm for computing "moving variance": ... Overwrite oldest value in X1 history buffer with X1. ...
    (comp.dsp)
  • Efficient Moving Average and Moving Variance Calculations
    ... efficient algorithm for computing a moving average. ... Overwrite oldest value in X1 history buffer with X1. ...
    (comp.dsp)