Expand description
Frequency-response, group-delay, and pole-based stability analysis for filters
produced by crate::filter_design or hand-written FIR/biquad coefficients.
These routines evaluate the DTFT H(e^{jω}) of a coefficient set directly (no FFT
required), so a filter design can be inspected at arbitrary frequencies before it is
deployed to a real-time processing path.
Functions§
- biquad_
cascade_ frequency_ response - Evaluates the combined frequency response of a cascade of Direct Form I biquad sections
(
coeffs.len()must be a multiple of 5, as produced by e.g.crate::filter_design::butterworth_lowpass_biquads) at a single normalized frequencyfreq_norm(cycles/sample,0.0..=0.5). - biquad_
cascade_ is_ stable - Returns
trueif every stage of a biquad cascade (coeffs.len()a multiple of 5) is stable. - biquad_
frequency_ response - Evaluates the frequency response
H(e^{jω})of a single Direct Form I biquad section[b0, b1, b2, a1, a2](as produced bycrate::filter_designand consumed bycrate::filtering::biquad_cascade_df1_f32, where `y(n) = b0 x(n) + b1 x(n-1) + b2 x(n-2) - biquad_
is_ stable - Returns
trueif the single biquad section[b0, b1, b2, a1, a2]is stable, i.e. both poles lie strictly inside the unit circle. - biquad_
l2_ norm - Computes the L2-norm energy
||H(e^{jω})||_2of a biquad section. - biquad_
peak_ gain - Computes the peak frequency response gain
||H(e^{jω})||_∞of a biquad section. - biquad_
pole_ radius - Computes the pole radius (largest pole magnitude on the z-plane) of a single Direct Form I
biquad section
[b0, b1, b2, a1, a2], whose poles are the roots ofz^2 - a1*z - a2 = 0. A causal LTI system is stable if and only if all poles lie strictly inside the unit circle (pole_radius < 1.0). - biquad_
q15_ frequency_ response - Evaluates the frequency response of a Q15 quantized biquad section.
- biquad_
quantization_ snr_ db - Computes the Signal-to-Quantization-Noise Ratio (SQNR in dB) between an ideal floating-point biquad cascade and its Q15 quantized equivalent.
- estimate_
biquad_ headroom_ bits - Estimates required integer headroom bits and peak gain for a biquad section.
- fir_
frequency_ response - Evaluates the frequency response
H(e^{jω}) = Σ h[k] e^{-jkω}of an FIR filter (or any raw coefficient sequence) at a single normalized frequencyfreq_norm(cycles/sample,0.0..=0.5, where0.5is Nyquist). - fir_
group_ delay - Computes the group delay (in samples),
τ(ω) = Re[B(e^{jω}) / H(e^{jω})]whereB(e^{jω}) = Σ k·h[k]·e^{-jkω}, of an FIR filter at a single normalized frequencyfreq_norm(cycles/sample,0.0..=0.5). For a linear-phase (symmetric) FIR of lengthM, this is constant and equal to(M - 1) / 2at every frequency. - fir_
quantization_ snr_ db - Computes the SQNR (in dB) between an ideal floating-point FIR filter and its Q15 quantized version.
- response_
magnitude - Returns the linear magnitude
|H(e^{jω})|of a complex frequency-response value. - response_
magnitude_ db - Returns the magnitude of a complex frequency-response value in decibels:
20 * log10(|H|). - response_
phase - Returns the phase (argument) of a complex frequency-response value, in radians, wrapped to
(-π, π].