IIR Filter
Calculates a biquad output from the current input and two internal delayed states.
Behavior
Section titled “Behavior”For sample n:
w(n) = u(n) - a1 * w(n-1) - a2 * w(n-2)y(n) = b0 * w(n) + b1 * w(n-1) + b2 * w(n-2)The initial states are w(-1) = w1_ic and w(-2) = w2_ic.
| Direction | Name | Type |
|---|---|---|
| Input | u |
T |
| Output | y |
T |
Parameters
Section titled “Parameters”| Name | Type | Default | Meaning |
|---|---|---|---|
T |
type (default f64) |
f64 |
Float scalar type |
b0, b1, b2 |
T |
1.0, 0.0, 0.0 |
Numerator coefficients |
a1, a2 |
T |
0.0, 0.0 |
Feedback coefficients; a0 is fixed at 1 |
w1_ic, w2_ic |
T |
0.0, 0.0 |
Initial delayed filter states |
T defaults to f64 and is a scalar float type. The denominator is monic (a0 = 1).
Example
Section titled “Example”With b0 = 0.5, a1 = -0.5, and all other coefficients and initial states
zero, inputs 1, 0, 0 produce 0.5, 0.25, 0.125.