Post Go back to editing

About Sigmastudio IIR coefficients

I'm a new comer to use Sigmastudio ,I have some question about the general 2nd-Order Filters module coefficients,I know how to calculate the five coefficients when use as  2nd-Order Filters,But I don't know how to calculate the five coefficients use as two first order Filters when use  2nd-Order Filters module.Forgive my spelling mistakes and looking forward to your professional reply.

best wishes for you,thank you.

  •      Hello hushan,

        Welcome to the forum, you'll find many interesting uses for SigmaDSP and SigmaStudio.

     

       Your question is a good one!  I could not find any docs on the combined first-order filter pairs.  As it turns out, it's possible to combine two first-order filters into one second-order structure using some basic z-transform theory -- something I knew nothing about until yesterday.  Studying this reference:  http://www.analog.com/media/en/technical-documentation/dsp-book/dsp_book_Ch33.pdf 

    over several hours, I learned just enough to cough up coefficients for a combination lowpass and highpass filter.

         Download the attached spreadsheet and scroll to its far right end, where you'll find the section shown below.  Enter your system sample rate and desired frequencies and gains for your filters.  The needed coefficients then appear.  You can click on each cell to see its formula, enabling you to code the calculations into a microcontroller if desired.  This spreadsheet was started years ago by the legendary BrettG, a former ADI support engineer.  I've been gradually expanding it to cover more kinds of filters.

         To test this math I built the project shown below.  When manually entering the coefficients into a second-order filter, the resulting response (green) matches that of the stock single-order highpass / lowpass filters (red):

         The same sort of math could work out coefficients for two lowpass filters, two highpass filters, two allpass filters, etc.  If the first-order filters are identical, you might as well go with an ordinary second-order filter with a low Q (about 0.5 ) instead.  In any event, I'm not presently in the mood to figure out any additional cases -- the algebra brings back awful memories from school.

         Best regards,

         Bob

    1st-2nd-Order_IIR_Coefficient_Calculator.xls
  • Thanks very much for you help.

    I read the document according to your suggestion,now I still have some question ,I sincerely hope you'll help me,This problem has troubled me for a long time。Can you point out which of the two sets of coefficients are correct。

    my sigmastudio version is 3.12.

    First picture is the sigmasudio capture window  generate coefficient ,the second picture is you provide of the coefficient.

  •      Hello Hushan,

         You could say that both are correct -- they're just different representations of the same thing.  DSP literature, I'm afraid, is subject to this sort of confusion.  For example, the reference I cited above, from Steven W. Smith's book Digital Signal Processing -- A Practical Guide for Engineers and Scientists, refers to feedforward coefficients with the letter a, and feedback coefficients with the letter b.  In other literature as well as in SigmaStudio, the a's and b's are flopped.

         The a coefficients' reversed polarity you discovered originate from the mathematical expression of the filter's transfer function.  In there, all the feedback coefficients show with minus signs.  Some DSP authors leave the minus signs in the formula, others transfer them to the coefficients.  In SigmaStudio, the a coefficients the program generate (or those you type into the boxes) are the polarity the math produces -- afterward they're negated when sent to the DSP (what you see in the Capture window).  Perhaps flipping their signs in SigmaStudio minimizes instruction usage in the DSP.

         Thus, if you have a microcontroller safeloading coefficients directly to the DSP, you need to flip the signs of the a coefficients yourself.  This particular confusion is so bad that more than one DSP reference suggests that you might as well toss a coin when giving signs to the feedback coefficients -- and if they don't work, just try the other way.

         Best regards,

         Bob