The frequency response
Given a filter with feedforward coefficients ${b_i}{i=0}^{P-1}$ and feedback coefficients ${a_i}{i=0}^{Q-1}$, the frequency response at angular frequency
For FIR filters, the denominator reduces to
From the complex-valued response:
Frequencies are evaluated on a logarithmic grid from
| Case | Time | Space | Notes |
|---|---|---|---|
| Average |
|
Given a simple first-order low-pass FIR filter with
- Compute
$\omega = 2\pi \cdot 10 / 100 = 0.2\pi$ - Numerator:
$0.5 \cdot e^{0} + 0.5 \cdot e^{-j0.2\pi} = 0.5 + 0.5(\cos(0.2\pi) - j\sin(0.2\pi))$ $= 0.5 + 0.5(0.809 - j0.588) = 0.905 - j0.294$
- Denominator:
$1.0$ $|H| = \sqrt{0.905^2 + 0.294^2} = 0.952$ - Magnitude:
$20\log_{10}(0.952) = -0.43$ dB - Phase:
$\arctan(-0.294/0.905) = -18°$
- Zero denominator: If the denominator evaluates to zero at a frequency, the implementation sets it to 1.0 to avoid division by zero. This produces a meaningful (if approximate) result near resonances.
-
QNumber conversion: When coefficients are in Q15/Q31 format, they are converted to float via
math::ToFloat()before evaluation. This ensures sufficient dynamic range for the complex arithmetic. -
Logarithmic spacing: Very low frequencies near DC may have sparse coverage. The lowest evaluated frequency is
$f_s / N$ . -
Phase wrapping: The
std::argfunction returns phase in$(-\pi, \pi]$ . Phase unwrapping is not performed.
- Linear frequency spacing: Alternative to logarithmic spacing for uniform frequency resolution.
- Zero-pole form: Evaluate directly from pole-zero locations rather than polynomial coefficients.
- Chirp z-transform: Generalization that evaluates the z-transform along arbitrary paths in the z-plane.
- Verifying filter coefficient designs match the desired specification
- Bode plot generation for stability analysis
- Comparing filter topologies (FIR vs. IIR, different orders)
- System identification validation
- FIR / IIR Filters: The frequency response evaluates the transfer functions implemented by
FirandIirfilters. - FFT: The DFT of a zero-padded impulse response produces the frequency response at uniformly spaced frequencies. This class generalizes to arbitrary frequency points.
- Root Locus: Both frequency response and root locus analyze the same transfer function from complementary perspectives (frequency domain vs. pole-zero domain).
- Power Density Spectrum: PDS estimates the spectral content of a signal; frequency response characterizes the system that shapes it.
- Oppenheim, A.V. and Schafer, R.W., Discrete-Time Signal Processing, 3rd ed., Pearson, 2009 — Chapters 5–6.
- Proakis, J.G. and Manolakis, D.G., Digital Signal Processing: Principles, Algorithms, and Applications, 4th ed., Pearson, 2006 — Chapter 6.
- Smith, S.W., The Scientist and Engineer's Guide to Digital Signal Processing, California Technical Publishing, 1997 — Chapter 21.