Why do I see only 5 coefficients change when I adjust Medium_Size_EQ?
I'm using the Medium Size EQ block and noticed that only 5 PRAM coefficients change when I move the sliders.
The wiki documentation says these are General 2nd order filters but the equations for said filters define 6 coefficients NOT 5.
So my question is: What's the exact equation SigmaStudio is using to modify the 5 filter coefficients for the Medium Size EQ algorithm?
Thanks!
-CT
Hello CT,
SigmaDSPs use an efficient implementation for second-order IIR filters which uses only one set of delays and which folds the six coefficients into five. Thus, SigmaStudio calculates the five coefficients A0, A1, B0, B1, and B2.
The legendary BrettG made a spreadsheet to calculate the five coefficients from the desired filter parameters. I have expanded this spreadsheet to handle additional filter types. You'll find it at EQ Low- and High-Shelf filter coefficients comming back - Mysterious S factor. Clicking on the spreadsheet cells reveals the formulas to calculate the intermediate results and the final coefficients.
One way to experiment with coefficients is to type them into the IIR Coefficient dialog available in the General 2nd Order Filter. Below are two filters, one set with the GUI, and one with coefficients calculated by the spreadsheet. They both show the same response.
Notice that the filter's schematic shows the a coefficients with minus signs in front. Thus, when safeloading your coefficients from a microcontroller (but not when typing them into SigmaStudio's IIR Coefficient dialog), you'll need to flip your a coefficient's signs.
Best regards,
Bob
KJ,
Thanks! That's just what I needed.
One more quick question:
I noticed the A1 and A2 coefficients have flipped signs as compared to what I'm seeing in PRAM.
Just curious as to why that is.
Thanks,
Charlie
Hello Charlie,
Richard G. Lyon's book Understanding Digital Signal Processing attributes the sign changes to convention. The theoretical calculations get so full of minus signs that some in the field chose to simply define the a coefficients as negative. Since this trade-off is not universal, he offers this advice: "If, while using software routines to design or analyze IIR filters, your results are very strange or unexpected, the first thing to do is to reverse the signs of the a(k) coefficients and see if that doesn't solve the problem."
BTW, the wiki entry General 2nd-Order Filters [Analog Devices Wiki] previously gave formulas yielding five coefficients, but now shows six with this footnote way at the bottom:
"For all of the above filters, the coefficients are divided by a0, normalizing them and making a0 = 1 so that only 5 coefficients must be stored. In the actual implementation on the DSP, when the coefficients are stored in parameter RAM, a1 and a2 need to be inverted. This is done automatically, in software [SigmaStudio], before the parameters are written to memory."
Great answer...thanks! ..... and normalizing makes sense and gets rid of a multiply as well.
Now I just need to convert your spreadsheet calculations to C-code for my controlling processor.
-Charlie
Got it all working! Wrote my C function definitions on an Arduino and I can now control the EQ via I2C. Thanks for the assistance!
Please log in to reply.



