Large moving average
- From: "dave_bonnell@xxxxxxxxxxx" <dave_bonnell@xxxxxxxxxxx>
- Date: 30 Aug 2006 11:21:05 -0700
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)
unless m = 2^k, in which case the divide can be replaced by a simpleFrom a computational standpoint, I can't imagine anything easier,
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
.
- Follow-Ups:
- Re: Large moving average
- From: Jerry Avins
- Re: Large moving average
- From: jim
- Re: Large moving average
- From: Andor
- Re: Large moving average
- From: Tim Wescott
- Re: Large moving average
- Prev by Date: Cholesky factors of matrices which are not positive-definite
- Next by Date: Re: Large moving average
- Previous by thread: Cholesky factors of matrices which are not positive-definite
- Next by thread: Re: Large moving average
- Index(es):
Relevant Pages
|