Large moving average



Hi all,

I've got a data rate of about 20 kHz and a desired LPF cutoff of about
2.5 Hz. For starters, I was unable to design an appropriate FIR to
manage this. Even if I was successful, I expect the # of
taps/computation required would have made the filter impractical. I am
using a 16-bit fixed point processor.

Fortunately, a simple moving average is adequate for my purposes. The
intent is to do the following in a circular buffer:

y = y + x[n] - x[n-m]

Where y is the accumulated result, x[n] is the current input sample,
and x[n-m] is the oldest input sample. I require an output at 200ms
intervals (every 4000 samples), and end up with:

z = y/m (z is the result I'm looking for)

From a computational standpoint, I can't imagine anything easier,
unless m = 2^k, in which case the divide can be replaced by a simple
right shift. Great.

BUT, the application has a number of channels (and therefore this
filter uses significant memory). Also, there is no guarantee that m
will be a power of 2, as my input data is only valid under certain
conditions.

To reduce memory, I have been considering a block filter that simply
accumulates the last 400ms worth of data and computes the result. Two
overlapping filters of this sort would be required to achieve the 200ms
output interval....

ALTERNATIVELY, I could reduce the block size (to 200 ms, or even less).
Each block would be averaged and the result stored. After enough data
was collected, the block averages could be averaged to generate an
overal average. If I really wanted to be perverse I could set my block
size to a power of 2 to reduce the block average/division to a simple
shift.

Questions:
1) I'm not sure about the terminology of these things, any help?
(specifically, with the taking an average of the already-averaged
blocks).

2) As I see it, I am getting a vast reduction in memory usage with no
penalty in terms of computational requirements. Something seems fishy
to me...have I missed anything?

Cheers,
Dave

.



Relevant Pages

  • Re: Large moving average
    ... taps/computation required would have made the filter impractical. ... Where y is the accumulated result, xis the current input sample, ... you are computing the mean of each successive 4000 sample block. ... To reduce memory, I have been considering a block filter that simply ...
    (comp.dsp)
  • Re: Large moving average
    ... taps/computation required would have made the filter impractical. ... To reduce memory, I have been considering a block filter that simply ... size to a power of 2 to reduce the block average/division to a simple ... penalty in terms of computational requirements. ...
    (comp.dsp)
  • Re: Large moving average
    ... taps/computation required would have made the filter impractical. ... Where y is the accumulated result, xis the current input sample, ... To reduce memory, I have been considering a block filter that simply ... Wescott Design Services ...
    (comp.dsp)
  • Re: blood pressure!
    ... WIth the filter i surely agree have lot of work needs to be done! ... power is hooked up backwards, if you've got everything miswired, it's ... and mount it right next to the sensor. ... if you want and apply that pressure again, or you can just ground one ...
    (sci.electronics.basics)
  • Re: Laptop video noise -- help
    ... power (from the HP, made in China, ... > 'brick') there's video noise on the screen. ... > automotive filter. ... Although this may be a 'mulligan stew' of circulating grounds, I tend to blame either the power 'brick' or the way HP is powering their their S-Video interface. ...
    (alt.tv.tech.hdtv)