# [music-dsp] Bandpass IIR Gain Factor

Thomas Rehaag developer at netcologne.de
Wed Apr 1 17:08:36 EDT 2009

```Hi Vesa,

after spending some hours on recalculating the gain factor with your
hint, watching the formulas growing I suddenly knew, this can't be the
right way - can't be, that a filter formula has a frequency dependent
gain! Went back to bilinear transformation theory and found the mistake.
There's been one erroneous line in my code:

m_fA1 = 4 * fDQ * fDiv;// from my first posting

should be:

m_fA1 = fDQ *fFd * fDiv;

now erverything works fine.

:)

Thomas

Vesa Norilo schrieb:
>
> Thomas Rehaag wrote:
> > Hi Vesa,
> >
> > so the equiation is:
> >
> > H(Z) = (a1 + a3 z^-2) / ( 1 + b2 z^-1 + b3 z^-2 )
> > = (a1 - a1 z^-2) / ( 1 + b2 z^-1 + b3 z^-2 )
> > = (a1 z^2 - a1) / ( z^2 + b2 z^1 + b3)
> >
> >
> > and I substitute Z = e^(i fRel Pi)
> >
> > ?
> >
> Yes, that's correct.
>
> The magnitude response of the filter is the absolute value of H(Z), and
> to get the point of Z-plane that corresponds to a real world frequency
> f/samplerate, you query H(e^i f pi). Absolute value is the magnitude and
> the argument is the phase response.
>
> A helpful identity with the absolute value of complex numbers is:
>
> |Z| = Sqrt(Z * Conjugate(Z))
>
> Vesa
> --
> dupswapdrop -- the music-dsp mailing list and website:
> subscription info, FAQ, source code archive, list archive, book reviews, dsp links
> http://music.columbia.edu/cmc/music-dsp
> http://music.columbia.edu/mailman/listinfo/music-dsp
```

More information about the music-dsp mailing list