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

GENERAL FIRST ORDER FILTER

SigmaDSP & SigmaStudio YLmazGNDZ May 16, 2022 00:00 7 replies Original on forum ↗
Subscribe
YLmazGNDZ Question
May 16, 2022 00:00

Hello. I am using frequency filter in Sigma studio. Some parts were not explained in the calculations and I was not sure. I do the calculations but it doesn't work. Can you help with the calculations? What values do A1,B0,B1 correspond to first?

https://wiki.analog.com/resources/tools-software/sigmastudio/toolbox/filters/general1storder

The calculations given on the site and the calculations of sigma studio are different. What is the problem? Can you help me?

pastedimage1652696355300v1.png
pastedimage1652696355300v1.png
pastedimage1652696366678v2.png
pastedimage1652696366678v2.png
KJBob Reply
May 16, 2022 00:00

Hello,

In the Capture Window, the first coefficient listed is B0, the second is B1, and the last is the feedback coefficient, A1. The wiki formulas calculate B0 and B1 identically to the Capture Window. The result for A1 is slightly different but works just fine, as demonstrated below. Note that you must invert the A coefficient(s) for the filter to work, this is a consequence of how the coefficients get stored in the DSP and is normal. The easiest way to test coefficients is to type them into the IIR Coefficient window of the General Second-Order Filter -- for first order, simply leave B2 and A2 at zero.

Best regards,

Bob

3678.Filter.png
3678.Filter.png
YLmazGNDZ Reply
May 18, 2022 00:00

Hello KJBob . I am trying to control it with microcontroller. For this I need mathematical calculation formulas. Although I tried the formulas on the site, the results are not the same. Why?

KJBob Reply
May 19, 2022 00:00

Hello YLmazGNDZ,

Yes the coefficients calculated via the Wiki reference do not exactly match what the Capture Window shows. My short answer is, I don't know why -- because the Wiki's formulas are straight out of the theory as given in a trusted DSP reference which its author and AD have generously provided here:

https://www.analog.com/en/education/education-library/scientist_engineers_guide.html

Pages 323 and 324 of Chapter 19 provide the equations. Note that the A and B coefficients are flopped, a difference in nomenclature rather common in the literature. Also the A coefficients need to be multiplied by the filter's linear gain (if not unity), and frequency is normalized to fs. Other than that, the coefficient formulas in the Wiki are identical to these.

It can be shown (by solving the formula for x backwards, and then comparing the A1 coefficients from the Capture Window to the ones calculated above) that the difference in performance between the two coefficient sets amounts to a cutoff frequency difference of about 0 .7 %. I'm saying difference, not error, because I honestly don't know which one is correct. Perhaps an ADI support engineer could explain why SigmaStudio's math behind the Capture Window differs from the theory. Or a member with more DSP knowledge than me (not a high bar; when I went to school the lab still had a few vacuum tubes!) might offer an explanation.

Unless your application demands a tighter tolerance than 1 %, the Wiki formulas, when programmed into your microcontroller, should prove good enough,

Best regards,

Bob

Formula1.png
Formula1.png
Formula2.png
Formula2.png
YLmazGNDZ Reply
May 26, 2022 00:00

Hello KJBob . I dont understand. I used this formule and ı looked sigma studio. values do not match. Sensitivity is not very important, but different values come out.

I think you are wrong because you did not add the gain to the formula in the pdf you said. I also applied the formula in sigmastudio.

wiki.analog.com/.../general1storder

pastedimage1653564504791v1.png
pastedimage1653564504791v1.png
DaveThib Reply
May 26, 2022 00:00

Hello YLmazGNDZ

On this post that you started there were some really great responses explaining how to get closer results for filter calculations.

(+) Medium Size EQ - Q&A - SigmaDSP Processors and SigmaStudio Development Tool - EngineerZone (analog.com)

There is also an older post that KJBob was also involved with. He had posted a spreadsheet that Brett had created many years ago. Have a look at that spreadsheet to see if it will help you. Brett used to be an Apps engineer for ADI

(+) IIR filter implementation issues - Q&A - SigmaDSP Processors and SigmaStudio Development Tool - EngineerZone (analog.com)

Dave T

.

KJBob Reply
May 27, 2022 00:00

Hello Dave,

I just found a typo in that spreadsheet I had posted and which you referenced above -- the corrected one is attached below. Unfortunately it still won't answer YLmazGNDZ's question since its first-order highpass formulas are the same as those of the wiki, thus do not exactly match what SigmaStudio does (via the Capture Window). It looks like only whoever programmed SigmaStudio's calculations can answer why they are not identical.

Best regards,

Bob

8206.1st-2nd-Order_IIR_Coefficient_Calc.zip

DaveThib Reply
May 27, 2022 00:00

Hello Bob,

Thanks for the update of the spreadsheet. YLmazGNDZ has been posting this same question several times which is really not very good to do on the forum. It makes it difficult to find answers and have a useful discussion.

Our friend and expert, bitmechanic, just answered his question! He was able to see what the problem is. Here is the answer to this post that is on the Audio space on the forum.

(+) General First Order - Q&A - Audio - EngineerZone (analog.com)

Dave T