I am implementing EQ lines in my filter. I need to do biquad with slope 24 db/oct, 36/oct and bigger so I would like to cascade several biquads. I am stuck with calculating frequency response of two biquads - now I am able to calculate magnitude and phase and draw one curve (peak filter). Should I multiply this response by itself? Thank you in advance for the answers.
The application of a filter to a signal in the time domain is defined as convolution. Convolution in the time domain is mathematically equivalent to multiplication in the frequency domain. So if we filter a signal, and then filter the output of the first filter, this is equivalent to multiplying the signal by both filters in the frequency domain. Therefor, this is equivalent to filtering with a third single filter whose frequency response is equal to the product of the first two filters’ frequency responses. Because frequency responses are complex numbers, the resulting magnitude is equal to the product of the two input magnitudes and the resulting phase is the sum of the input phases. This can be easily extrapolated for more than two filters as well.
Should I multiply this response by itself?
The transfer function of some cascaded biquads is simply the complex multiplication of the individual transfer functions, i.e. magnitudes are multiplied and phases are added.
It's much more efficient to design the filter at the desired order and property and then break it into biquads than the other way around. If you want a 36dB/octave filter, just design a 6th order Butterworth filter and don't cascade three second order Butterworth filters.
Thank you for the answer, but i need some clarification - i think i am missing something important to draw this plot. I am doing steps below:
- calculate in for loop freq response of standard biquad (peak) and get array of complex responses
- get abs() from each response and it gives me magnitude for given frequency on plot
- do 20 * log10(magn) to get values in dB and i am getting for example peak line with min in -9dB
- Phase i am calculating for each magnitude in first biquad using atan2(imag(freqRes)/real(freqRes)).
Then i am trying to calculate 4th order so cascading the biquad:
- each complex response from previous biquad i am multiplying by itself (freqRes)^2
- an multiply it by exp(2jphase) so (freqRes)^2 * (cos(2jphase) + sin(2j*phase)
- and do an abs() and 20log() from this value
I am getting incorrect values - instead of curve with max/min gain in -9 dB and steeper slope i have -18 dB. Maybe i am using phase incorrectly?