Page 2 of 2
Re: How to split high-order IIR to multiple biquads?
Posted: Mon Aug 18, 2014 10:15 pm
by MyCo
I've played with it a bit in my filter construction kit. I don't get what it does, the code isn't readable for me.
It looks like it finds the right poles, but somehow doesn't recover the zeros (maybe because they are on the imag. axis). It's also a bit instable. I fixed some bugs causing infinite loops already...
Re: How to split high-order IIR to multiple biquads?
Posted: Mon Aug 18, 2014 11:02 pm
by KG_is_back
Sorry, I can't open the schematic, so unfortunately I can't help you.
Mine uses Bairstow's method.
It is a method that finds u,v coefficients of a quadratic polynomial x^2+u*x+v that divides a given polynomial evenly (without remainer). Both B and A coefficients of a filter are a polynomial and in case of biquadratic filter they happen to be quadratic equations (as the name suggests), so what a Bairstow's method actually does in this particular case, if you use it on both A and B coefficients of your nth order filter you effectively 'extract' a biquad filter from it. Then you divide A by A of the biquad and B by B and you decrease the order of the filter (and it's polynomial) by 2 (because quadratic polynomial is of 2nd order and so is the biquad filter). You may repeat that several times until you are left with either a linear or quadratic polynome which represent the final biquad or bilinear filter. Notice that that is also the only one that has b0 coefficient different from 1.
I've found the Bairstow's method on wikipedia when I was searching for a method that can find roots of a polynomial without need of complex math. BM was the obvious winner, because it also finds the roots in pairs which is very convenient for extracting the biquads. Actually I didn't even used the full Bairstow's method because I didn't needed the roots - just the quadratic equation (so instead of additional step I actually needed to do one step less to get the biquad...lucky meee

).
BTW ruby is so cool... I wish I had looked into it sooner...

Re: How to split high-order IIR to multiple biquads?
Posted: Tue Aug 26, 2014 5:11 pm
by KG_is_back
A new version that supports double precision input (via string array) and prevents some errors, that were previously unchecked. Now you must enter B and A coefficients as separate inputs and A coefficients must contain a0 (which is usually =1) coefficient (it is normalized internally). B and A arrays may be of different size (missing values in the smaller array are assumed to be 0) but at least one of them must have at least 4 values (so the filter is order 3 or higher).
EDIT: small update: Now the input may be of order lower than 3 (4values) and the schematic will simply pass it on as biquad (even if the input is actually bilinear or simple gain)