View Single Post
  #2 (permalink)  
Old 07-08-2007, 07:28 AM
robert bristow-johnson
Guest
 
Posts: n/a
Default Re: Discrete IIR and step size

On Jul 7, 4:00 pm, "sancho-fx1" <sancho-...@gmx.de> wrote:
> Hi,
> I have implemented a simple IIR filtering algorithm (the one described in
> the dspguide book). The filter works inside a simulation application and
> the step size of the simulation can be changed by the user.


do you mean, by "step size", the reciprocal of the sampling frequency?

> However it
> stays constant throughout a simulation run. So my question is, how can I
> achieve identical results (as far as possible) of the IIR filtering with
> different step sizes.


assuming what i speculated above *and* that the IIR filter order is
fixed, if all of the interesting stuff about the IIR's frequency
response is much less than the reciprocal of the step size, you can
make the different simulations give you comparable results - i.e. the
impulse response of the IIR is a virtually identical function, but
simply sampled at different rates.

but, because of frequency-domain aliasing of the frequency response
(that you get from sampling the impulse response) from Impulse
Invariant and because of frequency warping of the frequency response
from the Bilinear Transform, i don't think you'll be able to acheive
identical results for an IIR filter that has salient frequency-domain
features in the entire spectrum from virtually DC to virtually
Nyquist. something on one end or the other will get ****ed up by any
discrete-time simulation other than the simulation that is synonymous
with the original IIR that you are comparing other sampling rate
implementations with.

> Currently the output of the filter for identical parameters will be
> different if the step size has changed.
>
> So my question would be. Is it possible to somehow 'compensate' for
> changes in the step size and if so, how would one implement it in the IIR
> calculation?


you could map the IIR coefficients according the the Impulse Invariant
method or the Bilinear Transform method. the two methods do it
differently and do not share the same degree of naturalness regarding
representation of the filter's transfer function (or the
implementation of the filter structure) as a series (cascade) 2nd-
order sections or as parallel sections. the BLT is fits series
biquads and II favors parallel.

it's a mess. for II you represent each complex pole pair as it's
impulse response:

h[n] = u[n]*A*exp(-alpha*n)*cos(omega*n + phi) + B*delta[n]


which has transfer function:

H(z) = (b0 + b1*z^-1 + b2*z^-2)/(1 + a1*z^-1 + a2*z^-2)

where

a1 = -2*exp(-alpha)*cos(omega)
a2 = exp(-2*alpha)
b0 = A*cos(phi) + B
b1 = -A*exp(-alpha)*cos(omega-phi) - B*2*exp(-alpha)*cos(omega)
b2 = + B*exp(-2*alpha)

so somehow you gotta map the five coefficients a1, a2, b0, b1, and b2,
to the five parameters alpha, omega, phi, A, and B (this is a bitch
and i am too lazy to do that). leave A, B, and phi unchanged but
scale alpha and omega in inverse proportion to how your step size got
scaled. then use the formulas above to get you new coefs a1..b2, for
the simulation with your changed step size. the impulse response (of
each section and therefore the sum of all of these parallel sections)
will be the same continuous-time impulse response but sampled at
different step sizes.

the Bilinear Transform will similarly painful but you will represent
your IIR filter as cascaded biquad sections and remap the same
continuous-time biquad to a discrete-time biquad filter with different
sampling rates (or step sizes).

famous last words: "all this is conceptully straight-forward and
doable but the details are left to the reader."

r b-j

Reply With Quote