#include <Filters/IIRFilter.hpp>
Infinite Impulse Response filter implementation that normalizes the coefficients upon initialization.
This class is faster than NonNormalizingIIRFilter, because each filter iteration involves only addition and multiplication, no divisions.
It works great for floating point numbers, but might be less ideal for integer types, because it can create large rounding errors on the coefficients.
Implements the following difference equation using the Direct-Form 1 implementation:
\[ y[n] = \frac{1}{a_0} \left(\sum_{i=0}^{N_b-1} b_i \cdot x[n-i] - \sum_{i=1}^{N_a-1} a_i \cdot y[n-i] \right) \]
Definition at line 127 of file IIRFilter.hpp.
Public Member Functions | |
NormalizingIIRFilter (const AH::Array< T, NB > &b_coefficients, const AH::Array< T, NA > &a_coefficients) | |
Construct a new Normalizing IIR Filter object. More... | |
NormalizingIIRFilter (const TransferFunction< NB, NA, T > &tf) | |
T | operator() (T input) |
Update the internal state with the new input \( x[n] \) and return the new output \( y[n] \). More... | |
Private Attributes | |
uint8_t | index_b = 0 |
uint8_t | index_a = 0 |
AH::Array< T, NB > | x = {} |
AH::Array< T, MA > | y = {} |
AH::Array< T, 2 *NB - 1 > | b_coefficients |
AH::Array< T, 2 *MA - 1 > | a_coefficients |
Static Private Attributes | |
static constexpr uint8_t | MA = NA - 1 |
|
inline |
Construct a new Normalizing IIR Filter object.
The coefficients \( b \) and \( a \) can be derived from the transfer function:
\[ H(z) = \frac{b_0 + b_1 z^{-1} + \ldots + b_{N_b} z ^{-N_b}} {a_0 + a_1 z^{-1} + \ldots + a_{N_b} z ^{-N_a}} \]
b_coefficients | The coefficients of the transfer function numerator. |
a_coefficients | The coefficients of the transfer function denominator. |
Definition at line 145 of file IIRFilter.hpp.
|
inline |
Definition at line 156 of file IIRFilter.hpp.
|
inline |
Update the internal state with the new input \( x[n] \) and return the new output \( y[n] \).
input | The new input \( x[n] \). |
Definition at line 167 of file IIRFilter.hpp.
|
staticconstexprprivate |
Definition at line 200 of file IIRFilter.hpp.
|
private |
Definition at line 201 of file IIRFilter.hpp.
|
private |
Definition at line 201 of file IIRFilter.hpp.
|
private |
Definition at line 202 of file IIRFilter.hpp.
|
private |
Definition at line 203 of file IIRFilter.hpp.
|
private |
Definition at line 204 of file IIRFilter.hpp.
|
private |
Definition at line 205 of file IIRFilter.hpp.