IIR Filtering Class Functions and Coefficient design


(Asouth) #1

Hi,

Id like to propose that the constructir for the OnlineIirFilter class is overloaded to allow coefficients to be specified as two arrays, one for the numerator and one for the denominator.

For example:

OnlineIirFilter octavebandfilter = new OnlineIirFilter(b,a);

Also i believe there a crippling bug with IIR implementation, IirCoefficients class seems to produce non-stable coefficients. Has anyone else tried this?

Thanks


(Tobias Glaubach) #2

Hi,
regarding the constructor: I strongly support your proposal.

regarding the non stability of the IIR coefficients:

  1. The source code comments state, that the implementation is based on the canoic Direct Form II structure. See here:
    https://github.com/mathnet/mathnet-filtering/blob/master/src/Filtering/IIR/OnlineIirFilter.cs
    Which is described here:
    https://ccrma.stanford.edu/~jos/fp/Direct_Form_II.html
    Every direct implemengtation (especially for high order filters) is numerically sensitive to roundoff errors on the coefficients (see last point on properties in the upper link). More stable would be to use a series of second order filters structure. See here:
    https://ccrma.stanford.edu/~jos/fp/Series_Second_Order_Sections.html

  2. Did you consider, that you are working with discrete time (or digital) systemes here? Stability is given by poles within a unit circle in the complex plane, as opposed to left half plane for continuous time systems. You can check the poles of your filter by using the Polynomial.GetRoots() method from MathNet (not sure, if in latest release yet though)