IIR filtering problem


#1

Hi There!

I’m trying to use the IIR filters from the Math.NET filtering library, but regardless of what I’m trying to do they all seem unstable.

Here’s what I’m trying to do:

Coefficients = MathNet.Filtering.IIR.IirCoefficients.LowPass(samplingRate, cutoff, Bandwidth)
The generated coefficients are:
[0]=0.00095657422963352223
[1]=1.9352362088989583
[2]=–0.9390625058174924
[3]=1
[4]=2
[5]=1

First off all I have no idea what Bandwidth is, I think it is supposed to be the bandwidth between the corner frequencies so in the case of a LowPass filter I think Bandwidth = cutoff, at least thats what I’m using right now.

I have a stochastic signa which is sampled with 10 kHz. I acquire a buffer of 1000 samples per sampling (so I get 1000 samples every 100 ms).

I’d like to low pass filter this signal using the calculated coefficients, but when I do this:

var filter = New MathNet.Filtering.IIR.OnlineIirFilter(Coefficients);
var filtered= filter.ProcessSamples(Buffer);

the filtered variable contains something unresembling the filtered signal.

Any idea what’s causing the filter to become unstable? No matter what cutoff frequency I use it is always unstable