# [PD] biquad~ with elementary filters [was: Re: dinosaurs ...]

Charles Henry czhenry at gmail.com
Mon Sep 15 18:52:52 CEST 2008

```On Mon, Sep 15, 2008 at 9:39 AM, Damian Stewart <damian at frey.co.nz> wrote:
> Frank Barknecht wrote:
>> Hallo,
>> Frank Barknecht hat gesagt: // Frank Barknecht wrote:
>>
>>>> 1*z^2 - fb1*z^1 - fb2 = 0
>>> zb = (-fb1 +- sqrt(fb1*fb1 - 4*fb2)) / 2
>>
>> Sorry, the one above is wrong, of course. Given the minus-signs in the
>> original transfer formula it should be:
>>
>> zb = (fb1 +- sqrt(fb1*fb1 + 4*fb2)) / 2
>>
>> if I'm right.
>
> see, Chuck, if Frank gets it wrong what chance do i have? ;-)

We all have problems with math ;)

This all looks good so far.
zf = (-ff2 +- sqrt(ff2*ff2 - 4*ff1*ff3)) / 2*ff1  (zeros)

zb = (fb1 +- sqrt(fb1*fb1 + 4*fb2)) / 2  (poles)

I am afpd at the moment, so I can't check the documentation for
cpole~/czero~ and throw in my 2 cents on the implemenation.  But I can
finish out the problem of finding ff1, ff2, ff3, fb1, and fb2 in terms
of zf+ zf- and zb+ zb-

first,  (the signs are clunky when writing them out in arthmetic, so
I'll just rename them)
and I'm going to write it out in a slightly different form.
zf1 = zf+ = -ff2/(2*ff1) + sqrt(ff2^2/(4*ff1^2) - ff3/ff1)
zf2 = zf- = -ff2/(2*ff1)  - sqrt(ff2^2/(4*ff1^2) - ff3/ff1)

zb1 = zb+ = (fb1 + sqrt(fb1^2 + 4*fb2)) / 2
zb2 = zb- = (fb1  - sqrt(fb1^2 + 4*fb2)) / 2

Then,
zf1 + zf2 = -ff2/ff1                             (real valued)
zf1  - zf2 = 2*sqrt( ff2^2/(4*ff1^2) - ff3/ff1) (could be real or imaginary)

zb1 + zb2 = fb1                               (real valued)
zb1  - zb2 = sqrt(fb1^2 + 4*fb2)       (could be real or imaginary)

The second one is easy to solve, and we will come back to the 1st one
after that.

fb1 = zb1 + zb2
fb2 = ( (zb1 - zb2)^2  - (zb1 + zb2)^2 )/4

the other has 3 variables and 2 equations.  so, we make our variables
into 2 groups
ff2/ff1 = - (zf1 + zf2)
ff3/ff1 = ( (zf1 + zf2)^2  - (zf1 - zf2)^2 )/4

Now, there's one free variable remaining, ff1.  ff1 could be zero,
which would give us a zero at z=0 and another real valued zero at
-ff3/ff2.

Otherwise, we take ff1 to be a scaling factor, which needs to be
chosen by some other condition (gain at some chosen frequency, most
likely).

Chuck

```