CMSIS Biquad Cascade IIR Filter + Iowa Hills IIR Filter Design

You are looking at CMSIS IIR Filters (https://www.keil.com/pack/doc/CMSIS/DSP/html/group__BiquadCascadeDF1.html), and don't know how to use it? Don't worry, this example will clearly help you.

The first thing that you need to know is that Biquad Cascade DF1 use this transfer function to do filtering.

y[n] = b0 * x[n] + b1 * x[n-1] + b2 * x[n-2] - a1 * y[n-1] - a2 * y[n-2]

It is hard to understand how this does filtering, especially if you looking at it in the time domain.
In short this transfer function use current input(x[n]), and two last input(x[n-1], x[n-2]) and output (y[n-1], y[n-2]).

Each new input function calculates new output and stores all the values. That is all that this filter does. The hardest part is to calculate coefficients b0, b1, b2, a1, a2, that is where Iowa Hills IIR  Filter Design jumps in.

In this example, I'll do the band-pass filter for 1 Hz. In the image below you can see, what I selected at Iowa Hills IIR  Filter Design.




Now you need to use calculated coefficients. You can check how I used them at my git hub project. 
Link to source code: https://goo.gl/XitNpT


And finally the results of the filtering.
 

If you find this useful you can consider to buy me a coffee

Buy Me A Coffee 

Comments

  1. Hello Igor, thanks for this post. One thing is not clear to me.
    It appear that the coefficients from "Iowa Hills IIR Filter Designer" have not only the a1 and a2 to be inverted, but the b2 too.
    As in your code in github and the image above, I see that the b2 value is inverted inside the array. Is it my interpretation correct?

    Many Thanks
    Clemente

    ReplyDelete
    Replies
    1. Hi Clemente, b2 doesn't need to be inverted.
      See:
      https://github.com/Igor-Misic/CortexM4_TM4C123GXL/blob/master/BiquadCascadeIIRFilter/arm_biquad_cascade_df1_f32.c#L59-L63

      Delete
    2. Also, b2 and b0 are the same value, where b0 has a negative sign.

      Delete
    3. Hello Igor,
      OK OK The order is differente and b0 has a differente sign.
      It's OK now.

      Many many thanks.

      Delete

Post a Comment

Popular posts from this blog

AUTOSAR and CRC calculation

Flashing/debugging/running code at external memory in the memory-mapped mode

Debugging EK-TM4C123GXL with Visual Studio Code on Linux