Hello all
I'm confused. My procedure generates different coefficient than FilterTableGen.
(Filter Table Generator)
very simple C source in attached file
Hello all
I'm confused. My procedure generates different coefficient than FilterTableGen.
(Filter Table Generator)
very simple C source in attached file
Hello wielad,
Welcome to the forum. As is often the case where unexpected results occur, there may be more than one issue in play here. It appears your C code is based on the same formulas as Brett's spreadsheet at https://ez.analog.com/docs/DOC-1819 , I've used this manually and have also based microcontroller code upon it; it worked for me either way. Comparing its coefficients with those from the FilterTableGen shows that both produce useful results. With the values you're using (1KHz /48KHz, Q=1.41, unity gain), the Generator produces this table:
The zero-boost case is interesting since it sets B0 = 1 and all others zero. Typing that directly into SigmaStudio's IIR Coefficient filter block yields a flat result as expected (note you need not negate the a0 and a1 coefficients when using this window, SigmaStudio does that for you):
The Parametric_EQ_IIR_Coefficient spreadsheet produces the different coefficients shown below, yet they also yield a flat response:
Apparently the FilterTableGen includes logic that realizes that with boost = 0 the filter is moot -- might as well do a unity-gain buffer. The spreadsheet doesn't recognize this condition but the math cancels out to a flat response anyway. For nonzero boost, the spreadsheet and Filter Gen produce similar coefficients and responses. This example is for boost = +10dB:
Since the spreadsheet works I compared its formulas to your C code and make a few changes -- file attached below.
Best regards,
Bob
Hello wielad,
Welcome to the forum. As is often the case where unexpected results occur, there may be more than one issue in play here. It appears your C code is based on the same formulas as Brett's spreadsheet at https://ez.analog.com/docs/DOC-1819 , I've used this manually and have also based microcontroller code upon it; it worked for me either way. Comparing its coefficients with those from the FilterTableGen shows that both produce useful results. With the values you're using (1KHz /48KHz, Q=1.41, unity gain), the Generator produces this table:
The zero-boost case is interesting since it sets B0 = 1 and all others zero. Typing that directly into SigmaStudio's IIR Coefficient filter block yields a flat result as expected (note you need not negate the a0 and a1 coefficients when using this window, SigmaStudio does that for you):
The Parametric_EQ_IIR_Coefficient spreadsheet produces the different coefficients shown below, yet they also yield a flat response:
Apparently the FilterTableGen includes logic that realizes that with boost = 0 the filter is moot -- might as well do a unity-gain buffer. The spreadsheet doesn't recognize this condition but the math cancels out to a flat response anyway. For nonzero boost, the spreadsheet and Filter Gen produce similar coefficients and responses. This example is for boost = +10dB:
Since the spreadsheet works I compared its formulas to your C code and make a few changes -- file attached below.
Best regards,
Bob