From: SYL on
Hi all,

Just found this piece of code from my old collection. But could not
find where it came from? Can anyone shed some light? I know it is from
butterworth and bilinear transform. But seemed not quite that,
particularlly the resonanceDB to r part.

-----------------------------------------------
c = 1.0 / (tan(pi * (fc / fs)));
csq = c * c;
r = 10.0^(-(resonancedB * 0.1));
q = sqrt(2.0) * r;
a0 = 1.0 / (1.0 + (q * c) + (csq));
a1 = 2.0 * a0;
a2 = a0;
b1 = (2.0 * a0) * (1.0 - csq);
b2 = a0 * (1.0 - (q * c) + csq);
-----------------------------------------------

Thanks
From: Vladimir Vassilevsky on


SYL wrote:

> Hi all,
>
> Just found this piece of code from my old collection. But could not
> find where it came from? Can anyone shed some light? I know it is from
> butterworth and bilinear transform. But seemed not quite that,
> particularlly the resonanceDB to r part.
>
> -----------------------------------------------
> c = 1.0 / (tan(pi * (fc / fs)));
> csq = c * c;
> r = 10.0^(-(resonancedB * 0.1));
> q = sqrt(2.0) * r;
> a0 = 1.0 / (1.0 + (q * c) + (csq));
> a1 = 2.0 * a0;
> a2 = a0;
> b1 = (2.0 * a0) * (1.0 - csq);
> b2 = a0 * (1.0 - (q * c) + csq);
> -----------------------------------------------


omega = tanf(M_PI*Fc/Fs);
Q = 1.0f/sqrtf(2.0f); // Butterworth 2nd

omega_q = omega/Q;
omega2 = omega*omega;
omega2_plus_1 = omega2 + 1.0f;
norma = 1.0f/(omega2_plus_1 + omega_q);
B[1] = 2.0f*(omega2 - 1.0f)*norma;
B[2] = (omega2_plus_1 - omega_q)*norma;
A[1] = 2.0f*(A[0] = A[2] = omega2*norma);



Vladimir Vassilevsky
DSP and Mixed Signal Design Consultant
http://www.abvolt.com