%Equalizer2_Qfactor
fc      = 1000;     %1kHz
Gain_dB = 12;       %12dB
fs      = 48000;    %48kHz
Q       = 0.71;

g=10^(Gain_dB/20);
t0=2*pi*fc/fs;
if g >= 1
beta=t0/(2*Q);
else
beta=t0/(2*g*Q);
end
a2=-0.5*(1-beta)/(1+beta);
a1=(0.5-a2)*cos(t0);
b0=(g-1)*(0.25+0.5*a2)+0.5;
b1=-a1;
b2=-(g-1)*(0.25+0.5*a2)-a2;

b=2*[b0 b1 b2];
a=[1 -2*a1 -2*a2];
bz0 = b(1);
bz1 = b(2);
bz2 = b(3);
az1 = -a(2);
az2 = -a(3);

fprintf('bz0 = %1.16f\n',  bz0);
fprintf('bz1 = %1.16f\n',  bz1);
fprintf('bz2 = %1.16f\n',  bz2);
fprintf('az1 = %1.16f\n',  az1);
fprintf('az2 = %1.16f\n',  az2);