Forums

Amplitude response of a Biquad Filter

Started by Web Surf January 27, 2006
I have a Guitar effects processor. It has an Equaliser ( five band Biquad
filter)

This equaliser accepts 5 coefficients

I wish to plot a graph of the amplitude versus frequency of this cascaded
filter. I am using Excel.

Can anyone assist with the formula to generate frequency response of a
Biquad filter.

Thanks !!!


Web Surf wrote:
> I have a Guitar effects processor. It has an Equaliser ( five band Biquad > filter) > > This equaliser accepts 5 coefficients > > I wish to plot a graph of the amplitude versus frequency of this cascaded > filter. I am using Excel. > > Can anyone assist with the formula to generate frequency response of a > Biquad filter. > > Thanks !!!
You'll need to bump the length up to a power of two (in this case, 8) by adding some zeros to the end. Then choose Tools | Data analysis..., and from the list choose "Fourier analysis". Then select the input range as your filter (plus zeros), and select the output range as the same length. You then need to take the IMABS() of each of the resulting coefficients (presumably in a third column) to compute the magnitude response. Then, plot that third column. Cheers! --M
mlimber wrote:
> Web Surf wrote: > > I have a Guitar effects processor. It has an Equaliser ( five band Biquad > > filter) > > > > This equaliser accepts 5 coefficients > > > > I wish to plot a graph of the amplitude versus frequency of this cascaded > > filter. I am using Excel. > > > > Can anyone assist with the formula to generate frequency response of a > > Biquad filter. > > > > Thanks !!! > > You'll need to bump the length up to a power of two (in this case, 8) > by adding some zeros to the end. Then choose Tools | Data analysis..., > and from the list choose "Fourier analysis". Then select the input > range as your filter (plus zeros), and select the output range as the > same length. You then need to take the IMABS() of each of the resulting > coefficients (presumably in a third column) to compute the magnitude > response. Then, plot that third column. > > Cheers! --M
Wait a minute! You said biquad. That procedure will only work for FIRs. I'll try to get back to you if no one else does. Work is calling... Cheers! --M
mlimber wrote:
> mlimber wrote: > > Web Surf wrote: > > > I have a Guitar effects processor. It has an Equaliser ( five band Biquad > > > filter) > > > > > > This equaliser accepts 5 coefficients > > > > > > I wish to plot a graph of the amplitude versus frequency of this cascaded > > > filter. I am using Excel. > > > > > > Can anyone assist with the formula to generate frequency response of a > > > Biquad filter. > > > > > > Thanks !!! > > > > You'll need to bump the length up to a power of two (in this case, 8) > > by adding some zeros to the end. Then choose Tools | Data analysis..., > > and from the list choose "Fourier analysis". Then select the input > > range as your filter (plus zeros), and select the output range as the > > same length. You then need to take the IMABS() of each of the resulting > > coefficients (presumably in a third column) to compute the magnitude > > response. Then, plot that third column. > > > > Cheers! --M > > Wait a minute! You said biquad. That procedure will only work for FIRs. > I'll try to get back to you if no one else does. Work is calling...
It also works for IIR filters (think of them as a ratio of two FIRs). Write all the numerator coefficients (5 biquads give 15 coefficients) in one column and zero pad to, say, 128. Write all the denominator coefficients (also 15 coefficients, don't forget that the first coefficient in the denominator is always 1.0), and zero pad to the same length. Take the Fourier transform of both columns. Divide the numerator column by the denominator column (using IMDIV), then take the absolute value of the result (using IMABS) which gives the desired magnitude versus frequency response (only use the first 65 numbers of the Fourier transform, the other 63 are just mirror images).
The Biquads each 5 coefficients like

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


There are 5 such Biquads in cascade = 25 coefficients in total ( each 24 bit 
signed)

Here is one set of coefficients :

           hex                decimal normalised
B0      100000          1
B1      E0765D        14.0289
B2      0F8CEA       0.971903
-A1     1F89A3       -1.9711
-A2     F07316       -15.0281

I need to plot its frequency response in Excel 


in article F_adnRXf18ptgEfeRVn-tg@giganews.com, Web Surf at
websurff@gmail.com wrote on 01/27/2006 08:19:

> I have a Guitar effects processor. It has an Equaliser ( five band > Biquad
filter)
> > This equaliser accepts 5 coefficients > > I wish to plot a graph of the amplitude versus frequency of this > cascaded
filter. I am using Excel.
> > Can anyone assist with the formula to generate frequency response of a
Biquad
> filter.
been all worked out: http://groups.google.com/group/comp.dsp/browse_frm/ thread/8c0fa8d396aeb444/a1bc5b63ac56b686 (unwrap line for URL) i need to put this into the cookbook. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
On Fri, 27 Jan 2006 07:19:44 -0600, "Web Surf" <websurff@gmail.com>
wrote:

>I have a Guitar effects processor. It has an Equaliser ( five band Biquad >filter) > >This equaliser accepts 5 coefficients > >I wish to plot a graph of the amplitude versus frequency of this cascaded >filter. I am using Excel. > >Can anyone assist with the formula to generate frequency response of a >Biquad filter. > >Thanks !!!
Hi, you can solve your plotting problem with Excel, but "it ain't easy". If I remember correctly, Excel has a built-in function to compute sines and cosines. You have to find the equation describing a biquad's frequency response in terms of; (1) the biquad's coefficients, (2) sine terms, (3) cosine terms, and (4) a freq variable that spans the range of 0 -to- pi. Your final freq response will a sequence of complex values, whose absolute value is what you want to plot. This might be a fun thing to do, but I'm guessing it would take most of one afternoon to get the cell relationships defined and get the whole thing working. How much enthusiasm & energy do you have? Good Luck, [-Rick-] Maybe Octave or SciLab would be better. You make the call.
>> >> Can anyone assist with the formula to generate frequency response of a >Biquad >> filter. > >been all worked out: > >http://groups.google.com/group/comp.dsp/browse_frm/ >thread/8c0fa8d396aeb444/a1bc5b63ac56b686 (unwrap line for
URL)
> > >i need to put this into the cookbook. > >-- > >r b-j rbj@audioimagination.com > >"Imagination is more important than knowledge." > > >
Thanks a million R B-J, Your formulae seem to work just fine with slight rounding errors. I can now read the coefficients of 5 cascaded Biquad filters from my Guitar Effects box and plot out a total frequency response in Excel. NB : I can e-mail the spreadsheet to anyone who is interested. Now I wish to move to the next step : I now want to design a new Equaliser setting and upload these into the Guitar Effects box I though of a simple an obvious software interface in Excel, three knobs per Biquad section for Gain, Centre frequency and Q. Can you assist with formula to convert given Gain, Centre Freq and Q into Biquad coefficients ?
> >The Biquads each 5 coefficients like > >% H(z)= b0+b1*z^-1+b2*z^-2 >% ----------------- >% 1+a1*z^-1+a2*z^-2 > > >There are 5 such Biquads in cascade = 25 coefficients in total ( each 24
bit
>signed) > >Here is one set of coefficients : > > hex decimal normalised >B0 100000 1 >B1 E0765D 14.0289 >B2 0F8CEA 0.971903 >-A1 1F89A3 -1.9711 >-A2 F07316 -15.0281 > >I need to plot its frequency response in Excel > > >
For the record, I made a mistake in converting the hex above to normalised decimals. The hex are 24 bit signed, so B1 and A2 are wrongly calculated above. Hence the initial graphs looked awry and threw me off-track.
Web Surf wrote:

   ...

> NB : I can e-mail the spreadsheet to anyone who is interested.
... I'd like a copy to see how it plays in OpenOffice. Like Rouzic, I don't pay for what's available free. Unlike him, I don't take what isn't offered. Jerry -- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;