ΣSigmaStudio Ask AI Русский Log in

IIR filter implementation issues

SigmaDSP & SigmaStudio BillMT Oct 22, 2019 00:00 6 replies Original on forum ↗
Subscribe
BillMT Question
Oct 22, 2019 00:00

I'm trying to enter a simple BEQ filter using the IIR function in the parametric filter block and I have two issues.

1. The displaying filter spectrum is incorrect.

2. The measured transfer function of the filter is inversed. It is a cut filter but measures as a boost filter.

The coefficients are as follows.

A B

1
0.228900702

-1.985595938
-0.450682967

0.985840917
0.221837867

I've tried changing the signs of A1 and A2 as noted in another thread about this but the result still is not correct.

Is there a bug in SigmaStudio or am I doing something wrong?

Edit Notes
modified title

[edited by: BillMT at 3:33 PM (GMT 0) on 22 Oct 2019]

pastedimage1571758281458v1.png
pastedimage1571758281458v1.png
KJBob Reply
Oct 23, 2019 00:00

Hello,

Typing your set of coefficients into the filter provides this response:

Note that the a0 coefficient isn't entered; also SigmaStudio inverts the a coefficients so you need not invert them when entering them here. You do need to invert the a coefficients when directly safeloading them from a microcontroller.

I calculated coefficients for a 1 KHz, boost 10 dB, Q = 1 parametric filter and entered them into the filter -- it came out as expected:

The attached spreadsheet calculates coefficients for a variety of filters. You can extract its formulas for use in microcontroller code.

Best regards,

Bob

(the original attachment was in error so I deleted it -- please find the spreadsheet in my next post below)

BEQ.png
BEQ.png
1K-Parametric.png
1K-Parametric.png
BillMT Reply
Oct 24, 2019 00:00

Hi Bob,

Thanks for your reply.

It appears as though the program I am using to generate the coefficients has a bug in it and the website I used to generate the response in my original post is also incorrect.

Can you please reattach the spreadsheet? I only found a zip file containing an image. Thank you.

KJBob Reply
Oct 24, 2019 00:00

Hi Bill,

You're not the first one to find variations in coefficient calculations whether via programs or in the literature. I've had to work around typos and such to get coefficients which work as expected with the IIR Filter block. This spreadsheet was started by the legendary Brett G., who was an ADI support engineer when I had first started with SigmaStudio. I expanded it to include more filter types as the need came up. Hopefully this attachment works. BTW, it appears that the Taligent forum software allows only two items (images + zip archives) per post. I miss the old Jive-based forum, this one is driving me up the wall. Edit -- the calculations for the Shelf filters in this spreadsheet are incorrect so I deleted the spreadsheet. As-is the formulas definitely produce a shelf filter, yet its slope isn't as steep as expected. Please see my post below for a corrected spreadsheet which works even for extreme values of S which produce response undershoots. The new spreadsheet also works should you choose to input Q as a parameter rather than S.

Best regards,

Bob

BillMT Reply
Oct 24, 2019 00:00

Thanks for the spreadsheet... very helpful!

KJBob Reply
Jun 6, 2020 00:00

Hello,

Here's the corrected spreadsheet:

5850.1st-2nd-Order_IIR_Coefficient_Calc.zip

BillMT Reply
Jun 11, 2020 00:00

thanks for the updated file!