Digital Biquad Filters


Second order recursive linear filtering

Brief:


Biquad refers to the fact that the transfer function of the filter is the ratio of two quadratic functions:

\(H(z) = {b_{0} + b_{1}z^{-1} + b_{2}z^{-2} \over {a_{0} + a_{1}z^{-1} + a_{2}z^{-2}}}\)

Higher-order IIR filters are prone to instability due to coefficient quantization, so they are often implemented as cascaded biquad sections, ensuring all poles remain inside the unit circle in the Z-domain for stability.

Second order filters are also very simple to implement, as they only require managing six coefficient values and four state values. Implementing a biquad filter is as simple as defining the difference equation:

\( y_{n} = {b_{0} \over a_{0}}x_{n} + {b_{1} \over a_{0}}x_{n - 1} + {b_{2} \over a_{0}}x_{n - 2} - {a_{1} \over a_{0}}y_{n - 1} - {a_{2} \over a_{0}}y_{n - 2}\)

The coefficients \( b_{0} \over a_{0} \), \( b_{1} \over a_{0} \), etc. can be pre-computed.

You can learn more about various types of Biquad Filters by clicking the links in the Table of Contents.


Implementation


You can find a C++ and Rust implementation of various biquad filters on my GitHub page:

Repo card