Re: Large moving average
- From: Mark Borgerding <mark@xxxxxxxxxxxxxx>
- Date: Thu, 31 Aug 2006 01:03:11 GMT
Jerry Avins wrote:
dave_bonnell@xxxxxxxxxxx wrote:....
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]
That is an FIR filter. It's not suitable for floating-point implementation.
I did a double-take when I saw this.
I'm sure Jerry didn't mean to indicate that all FIR filters are
unsuitable for floating-point calculations.
In case I'm not the only one who misunderstood, I will clarify.
Using feedback in the above manner described leads to a potentially
unstable situation -- a pole on the unit circle.
e.g. consider a floating point moving average of three samples across
the sequence. For simplicity sake, ignore the division by 3.
input: [ 1e20 2e20 3e20 4e20 5 0 0 0 0 0 ]
step 1: 1e20 + 2e20 + 3e20 = 6e20. Correct
step 2: 6e20 + 4e20 - 1e20 = 9e20. Correct
step 3: 9e20 + 5 - 2e20 = 7e20. Sort of correct
step 4: 7e20 + 0 - 3e20 = 4e20. Sort of correct
step 5: 4e20 + 0 - 4e20 = 0 . Wrongo!! should be 5
step 6: 0 + 0 - 5 =-5 . Wrongo!! should be 0
The problem is that the quantization error depends on the amount
currently in the sum.
A constant quantization unit, such as with fixed-point processing,
prevents drift.
--
Mark Borgerding
.
- Follow-Ups:
- Re: Large moving average
- From: Jerry Avins
- Re: Large moving average
- References:
- Large moving average
- From: dave_bonnell@xxxxxxxxxxx
- Re: Large moving average
- From: Jerry Avins
- Large moving average
- Prev by Date: Re: Frequency Inversion
- Next by Date: Re: Large moving average
- Previous by thread: Re: Large moving average
- Next by thread: Re: Large moving average
- Index(es):
Relevant Pages
|