Butterworth IIR filter design and application via numerically stable second-order sections. More...


Go to the source code of this file.
Classes | |
| struct | UTILSLIB::IirBiquad |
| Coefficients of one second-order IIR section (biquad). More... | |
| class | UTILSLIB::IirFilter |
| Butterworth IIR filter design and application using second-order sections. More... | |
Namespaces | |
| namespace | UTILSLIB |
| Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms). | |
Butterworth IIR filter design and application via numerically stable second-order sections.
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors
Direct-form realisations of high-order IIR filters are numerically unstable on finite-precision hardware because tiny coefficient perturbations cause large pole-position errors. IirFilter side-steps the problem by factoring every Butterworth design into a cascade of second-order sections (biquads, SOS), each carrying one conjugate pole pair, then iterating the cascade with the standard Direct-Form II topology. The result is well-behaved up to very high orders and is the same arrangement that scipy.signal.sosfilt uses.
The design itself follows the classical pipeline: analogue Butterworth prototype → lowpass-to-(LP|HP|BP|BS) frequency transform with pre-warped edge frequencies → bilinear s→z mapping. Zero-phase filtering is provided by running the SOS cascade forward, time-reversing, running it a second time and time-reversing again, which cancels the per-section group delay exactly.
Reference: A. V. Oppenheim & R. W. Schafer, "Discrete-Time Signal Processing", 3rd ed., Ch. 7.
Definition in file iirfilter.h.