AnsweredAssumed Answered

Calculating IIR DF1 coefficients

Question asked by rs85 on Dec 19, 2017
Latest reply on Jul 10, 2018 by QGingerZ

Hi there,

 

I'm new to DSP and was hoping for a little guidance on generating filter coefficients for an IIR Direct Form 1 filter on a BF707. I am hoping to generate filter coefficients on the fly based on user input. I have had good results so far using general C++ lowpass filter code sketches, but I would prefer to use the built in optimized functions like iirdf1_fr32, etc.

 

I am having trouble understanding the way that the iirdf1 function is expecting to read from the coefficient arrays-- for example, in the Audio Filter sketch included with the Blackfin dev board, the IIR uses these a and b coefficients for the lowpass filter at 1khz:

 

NUM_STAGES = 2;

const long double a_coeffs_low_1khz[(2 * NUM_STAGES)]     = {-3.90629342L, 5.74132017L, -3.76262386L, 0.92766971L};
const long double b_coeffs_low_1khz[(2 * NUM_STAGES) + 1] = {0.01004288L, -0.03833192L, 0.05662947L, -0.03833192L, 0.01004288L};

 

Many of the formulae I have found for calculating filter coefficients give an output of b0,b1,b2, and a1, a2 coefficients. Since this represents a 2-stage filter, I am unsure how to correctly populate these values (since there are 4 "a" coefficients and 5 "b" coefficients).

 

If anybody could point to the correct formula for calculating these coefficients or steer me in the direction of the relevant reading material it would be very much appreciated.

Outcomes