Re: Fixed Point IIR implementation




Fred Nach wrote:
>
> I would like to implement a IIR Biquad filter using the fixed point
> arithmetics...
> Hence to reduced the intermediate states I plan to use the following trick:
> s(k) = x(k) -a1*s(k-1) -a2*s(k-2)
> y(n) = b0*s(k) + b1*s(k-1) + b2*s(k-2)
>
> The I can compute each y, saving only 2 states (s(k-1) aénd s(k-2))...

this is the Direct 2 Form (sometimes called the "Direct II Canonical
Form"). unrecommeded for floating-point (if the Q is quite high, you
end up subtracting numbers very close to each other and losing
precision) and *highly* unrecommended for fixed-point (saturation
clipping will be your lot).

try the Direct 1 Form:

y[n] = b0*x[n] + b1*x[n-1] + b2*x[n-2] - a1*y[n-1] - a2*y[n-2]

every product on the right side of the = sign is a double precision
fixed point and all of those products should be added together in
double precision. this is trivial in the Mot 56K and the ADI SHArC and
maybe in the TI fixed-pointers.

> BUT ... in order to scale my coefficients or input, I need to know what
> are the boundaries of the s(k) serie... in order to find a proper Fixed
> Point format for my coefficients..

your coefs are defined strictly in terms of the frequency response you
want. the gross range of a1 is -2 to +2 and a2 is -1 to +1 for any
stable biquad filter. the b0, b1, b2 coefs can be nearly anything but
you will have to choose a range and possibly do some scaling using the
arithmetic shift operation on the result before saving to y[n].

> So my questions are :
>
> * for which conditions, s(k) is bounded
> * If the s(k) is bounded, what are the boundaries?

that is a purely artificial construct. are your fixed-point signal
values considered 16 bit signed integers? then it's -32768 <= x[n] <
+32768 . are they normalized? then it's -1 <= x[n]< +1. their range
is whatever you want them to be.

> Thanks in advance for your help (and sorry for my poor englsih)

as Jerry said, your English is fine.

r b-j

.



Relevant Pages

  • Re: Rational Numbers
    ... It is claimed that decimal FLOATING-point ... |> to explicitly round back down to the precision that you want when you ... Financial calculations are defined in terms of decimal fixed-point, ... specify more digits than they possibly need, ...
    (comp.lang.python)
  • Re: interpolation accuracy, oversampling and fractional interpolation
    ... interpolation between entries of that table. ... in a practical system with fixed precision ... there is a number of phases beyond which the coefficients won't change ... hypothetical impulse response) that will look more like a windowed sinc ...
    (comp.dsp)
  • Re: finite-differencing and machine errors
    ... will not lose any more precision. ... This generally requires the computation of the quotients such as ... The coefficients are needed for calculating the Jacobian matrix of the AE ...
    (sci.math.num-analysis)
  • Re: computing rational values of cos(x)
    ... so if the coefficients are rational, ... though operations are being carried out with integer precision. ... filters with very low stop-band attenuation, the quantization severely ...
    (sci.math)
  • Re: reply the answer
    ... top bit is much better spent representing times in the past than in ... function for finer precision when it's needed. ... You don't need to make it fixed-point at all. ... If you're not going with the POSIX time_t, ...
    (comp.lang.c)