A filter has linear phase if its phase response is a linear function of frequency, meaning all frequency components of a signal are delayed by the same amount of time (constant group delay). This property preserves the shape of a waveform as it passes through the filter, preventing phase distortion.
In practice
In embedded DSP work, linear phase is most commonly associated with FIR filters. A symmetric FIR filter (where coefficients satisfy h[n] = h[N-1-n]) guarantees linear phase across the entire band of interest, provided coefficient symmetry is maintained exactly in the implementation -- fixed-point rounding or other implementation errors that break symmetry will degrade the linear-phase property. Anti-symmetric FIR filters also achieve linear phase (with a 90-degree offset), and the four standard linear-phase FIR types (Type I through IV) cover the combinations of symmetric/anti-symmetric and odd/even length. This makes symmetric FIRs the default choice for applications where waveform shape must be preserved -- audio processing, ECG/EEG signal conditioning, pulse detection, and communications baseband filtering are common examples.
The cost of linear phase FIR filters is latency. For a causal Type I symmetric FIR of length N, the fixed group delay is (N-1)/2 samples -- one common and convenient case, though other linear-phase FIR types and non-causal representations use different indexing conventions and will have different delay expressions. On a Cortex-M4 running at 168 MHz processing audio at 48 kHz, a 127-tap FIR adds roughly 1.3 ms of delay. In closed-loop control systems, this latency can reduce phase margin and destabilize the loop, so IIR filters (which are generally not linear phase but have lower latency for a given roll-off) are often preferred there despite their phase distortion.
IIR filters -- Butterworth, Chebyshev, elliptic -- do not have linear phase. Their group delay varies with frequency, which means transients and wideband signals arrive smeared in time at the output. For applications like envelope detection, QRS detection in ECG, or any system where relative timing between frequency components matters, IIR phase distortion can corrupt results in ways that are not immediately obvious from a magnitude-only frequency response plot.
When linear phase and low latency are both required, one practical option on resource-constrained targets is to use a minimum-phase FIR, which reduces group delay relative to a linear-phase FIR of the same length but sacrifices linear phase in doing so -- it addresses the latency side of the trade-off, not both requirements simultaneously. Another option is to apply forward-backward filtering (filtfilt-style) offline. Forward-backward filtering passes the signal through the filter twice -- once forward, once reversed -- yielding zero net phase distortion and doubling the effective filter order, but it requires the entire signal to be buffered and cannot be used in real-time streaming applications.
Learn this in DSP Foundations
Discussed on DSPRelated
Frequently asked
What is group delay, and how does it relate to linear phase?
Group delay is the negative derivative of the
phase response with respect to frequency: tau(omega) = -d(phi)/d(omega). If the phase response is perfectly linear (phi(omega) = -k * omega), then the derivative is constant and group delay is flat -- every frequency component is delayed by the same k samples. A non-constant group delay means different frequencies arrive at the output at different times, distorting the shape of any signal that contains more than one frequency component.
Do all FIR filters have linear phase?
No. Only
FIR filters with symmetric (or anti-symmetric) coefficient arrays are guaranteed to have exactly linear
phase. An arbitrarily designed FIR -- one produced by, say, iterative optimization without a symmetry constraint -- will generally not have linear phase. The four standard linear-phase FIR types (Type I through IV) are defined by their symmetry and odd/even length combinations, each with slightly different behavior at DC and
Nyquist.
Can an IIR filter be made linear phase?
Not in a causal, real-time implementation.
IIR filters are inherently recursive and cannot achieve exact linear
phase in causal form. The forward-backward (zero-phase) technique achieves zero phase distortion by processing data twice in opposite directions, but requires the complete signal block to be available in memory, ruling it out for streaming use. Some designs use
all-pass IIR sections to approximately equalize
group delay over a limited band, but this is an approximation rather than true linear phase, and achieving a close approximation across a wide band with a causal IIR is generally impractical.
Does linear phase matter for audio applications on embedded targets?
It depends on the use case. Human hearing is relatively insensitive to
phase distortion in steady-state audio, so
IIR filters are often acceptable for equalization or simple bandpass work. However, for applications involving transient reproduction, cross-over networks where multiple bands are recombined, or algorithms that analyze phase relationships between channels, linear phase FIRs are typically preferred. The latency penalty (see 'The Phase Vocoder Transform' for phase-sensitive audio examples) must be weighed against fidelity requirements and available CPU cycles.
How do I verify that my filter implementation has the expected linear phase on a real target?
Apply a broadband test signal (impulse or swept sine) and capture the output. Compute the
phase spectrum of the output relative to the input using a
DFT -- the method is covered in 'Phase and Amplitude Calculation for a Pure Real Tone in a DFT: Method 1'. A linear-phase filter should show a phase vs. frequency plot that is a straight line with slope equal to -(N-1)/2 samples in the passband. Deviations indicate implementation bugs such as coefficient rounding, accidental coefficient asymmetry, or fixed-point overflow.
Differentiators vs similar concepts
Linear
phase is often contrasted with minimum phase. A minimum-phase filter concentrates its energy as early as possible, achieving the minimum possible
group delay for a given
magnitude response, but at the cost of nonlinear (frequency-dependent) phase. A linear-phase
FIR has constant group delay across all frequencies but introduces more total latency. Zero phase is a related term for the result of offline forward-backward filtering: the net phase shift is zero at all frequencies, but the technique is non-causal and cannot run in real time. In practice, choosing among these involves a trade-off between latency, phase distortion, and whether the system operates on buffered or streaming data.