IIR Filter
Shippingstatefuliir_filterStateful Butterworth filter with biquad cascade and DirectForm2Transposed
Signature
Inputs
signalSignalrequired
Outputs
resultSignal
Parameters
| Key | Type | Default | Notes |
|---|---|---|---|
filter_type | enum | lowpass | one of: lowpass, highpass, bandpass, bandstop |
cutoff_low | float | 1000.0Hz | |
cutoff_high | float | 2000.0Hz | |
order | int | 1 |
Description
IIR Filter applies a recursive infinite-impulse-response Butterworth filter to a signal. Internally it designs the analog Butterworth prototype for the requested filter_type and order, bilinear-transforms it to the discrete domain at the incoming signal's sample rate, and factors the resulting transfer function into a cascade of second-order sections (biquads). Each biquad runs in Direct Form II Transposed, which minimizes coefficient sensitivity and internal state count.
The node is stateful. Filter delay state ( registers) persists across runs, so streaming a long signal in successive blocks yields exactly the same output as filtering it whole — there is no seam or transient at block boundaries. The coefficient set is cached and rebuilt only when the parameter signature (filter_type, cutoff_low, cutoff_high, order, sample rate) changes.
Filtering is linear and unit-preserving: the output carries the same physical unit as the input, and the transfer is single-rate (same length in, same length out). For lowpass and highpass only cutoff_low is used as the edge; bandpass and bandstop use cutoff_low and cutoff_high as the two band edges. Because the operation is a weighted linear combination of samples, uncertainty ($\sigma$) propagates through the same difference equation applied to input variances (positively correlated within the recursion), so filtered noise floors are attenuated in the stopband alongside the signal.
Mathematics
Examples
Anti-alias lowpass before decimation
Filter a 10 kHz-sampled sensor stream to remove content above 1 kHz prior to resampling:
filter_type = lowpass
cutoff_low = 1000 # Hz, -3 dB edge
order = 4 # 24 dB/octave roll-offA 4th-order lowpass attenuates by roughly ; the output retains the input's unit (e.g. V) and its length.
Bandpass isolation of a tone
Extract a 50 Hz mains component from a noisy measurement using a bandpass with edges straddling the line frequency:
filter_type = bandpass
cutoff_low = 45 # Hz
cutoff_high = 55 # Hz
order = 2Streaming the record in blocks yields an identical result to filtering it in one pass, because the biquad state carries over.
Applications
- Anti-aliasing and reconstruction filtering in real-time data acquisition and resampling chains.
- Isolating or rejecting narrow bands (e.g. line-frequency hum, carrier tones) in vibration, acoustic, or biomedical signals.
- Smoothing/de-noising control-loop feedback where low group delay and low computational cost matter more than linear phase.
- Emulating analog Butterworth signal-conditioning front-ends in hardware-in-the-loop and Simulink-class simulations.
Neat
Butterworth is the *maximally flat* magnitude response: the first $2N-1$ derivatives of $|H(j\omega)|$ vanish at DC, so the passband has no ripple at the cost of a gentler transition than Chebyshev or elliptic designs.
Direct Form II Transposed needs only two state registers per biquad regardless of the numerator/denominator, and its transposed structure keeps quantization noise low — the reason it is the standard streaming IIR topology.
Known issues
High `order` combined with a cutoff far below the Nyquist frequency pushes poles very close to the unit circle; bilinear-transform coefficient conditioning can degrade and long-lived transients appear. Prefer moderate orders or cascade multiple stages.
IIR filters are not linear-phase: they introduce frequency-dependent group delay, so sharp transient edges are smeared and phase-sensitive downstream measurements may need compensation.