Fiveable

📡Advanced Signal Processing Unit 2 Review

QR code for Advanced Signal Processing practice questions

2.5 Finite impulse response (FIR) filters

2.5 Finite impulse response (FIR) filters

Written by the Fiveable Content Team • Last updated August 2025
Written by the Fiveable Content Team • Last updated August 2025
📡Advanced Signal Processing
Unit & Topic Study Guides

Properties of FIR filters

A Finite Impulse Response (FIR) filter is a digital filter whose output settles to zero after a finite number of samples when you feed it an impulse. This "finite duration" property is what distinguishes FIR filters from IIR filters and is the source of several desirable characteristics.

Three properties define FIR filter behavior:

  • Linear phase response — achievable by design, preserving waveform shape across frequencies
  • Inherent stability — guaranteed regardless of coefficient values, since there's no feedback
  • Causality — output depends only on current and past inputs, making real-time processing possible

All of these properties trace back to the filter coefficients h[n]h[n], which are the impulse response. Once you know those coefficients, you know everything about the filter.

Linear phase response

FIR filters can be designed so that the phase shift they introduce is a linear function of frequency. This matters because a linear phase means all frequency components of the signal are delayed by the same amount of time. Without it, different frequencies arrive at different times, distorting the waveform shape.

To achieve linear phase, the impulse response must satisfy one of two symmetry conditions:

  • Symmetric (Type I/II): h[n]=h[N1n]h[n] = h[N-1-n]
  • Antisymmetric (Type III/IV): h[n]=h[N1n]h[n] = -h[N-1-n]

where NN is the filter length. Symmetric coefficients are used for standard lowpass/bandpass designs, while antisymmetric coefficients arise in differentiators and Hilbert transformers. The four "types" come from combining symmetric/antisymmetric with odd/even NN, and each type has constraints on where the response must be zero (e.g., Type III forces zeros at ω=0\omega = 0 and ω=π\omega = \pi).

Stability of FIR filters

FIR filters are always stable. The reason is structural: there is no feedback path. The output is just a weighted sum of a finite number of input samples, so it can never diverge or oscillate on its own.

Contrast this with IIR filters, where feedback means the output feeds back into the computation. If the poles of an IIR filter land outside the unit circle, the output blows up. FIR filters have no poles (other than the trivial ones at z=0z = 0), so this failure mode simply doesn't exist. As long as the coefficients h[n]h[n] are finite real numbers, stability is guaranteed.

Causality in FIR filters

A causal system produces output based only on the current and past input samples. For an FIR filter, this means:

h[n]=0for n<0h[n] = 0 \quad \text{for } n < 0

In practice, every real-time FIR implementation is causal. The impulse response starts at n=0n = 0 and ends at n=N1n = N-1. Non-causal FIR filters do appear in offline processing (where you have access to the entire signal), but for any application where you compute output sample-by-sample as data arrives, causality is required.

Impulse response of FIR filters

The impulse response h[n]h[n] is the filter's output when the input is a unit impulse δ[n]\delta[n]. For an FIR filter, this response completely characterizes the system: the frequency response, phase behavior, and input-output relationship all follow directly from h[n]h[n].

Finite duration

The impulse response is nonzero only over the interval n=0n = 0 to n=N1n = N-1, giving it a finite duration of NN samples. The filter order is N1N-1.

There's a direct trade-off here: a longer impulse response (larger NN) gives you sharper frequency selectivity and deeper stopband attenuation, but it costs more multiplications per output sample and introduces a longer group delay of N12\frac{N-1}{2} samples.

Transfer function of FIR filters

The transfer function is the z-transform of the impulse response:

H(z)=n=0N1h[n]znH(z) = \sum_{n=0}^{N-1} h[n] z^{-n}

This is a polynomial in z1z^{-1} of degree N1N-1. The coefficients of this polynomial are exactly the impulse response values h[n]h[n].

Zeros of the transfer function

Since H(z)H(z) is a polynomial (no denominator other than z(N1)z^{-(N-1)}), FIR filters have only zeros and trivial poles at the origin. IIR filters, by contrast, have both nontrivial poles and zeros.

The placement of zeros in the z-plane controls the frequency response:

  • Zeros near the unit circle create deep nulls at the corresponding frequency, producing sharp attenuation.
  • Zeros far from the unit circle have a gentler effect on the magnitude response.
  • For linear-phase FIR filters, zeros appear in conjugate reciprocal pairs (if z0z_0 is a zero, so is 1/z01/z_0^*), which enforces the required coefficient symmetry.

Difference equation for FIR filters

The time-domain input-output relationship of an FIR filter of order N1N-1 is:

y[n]=k=0N1h[k]x[nk]y[n] = \sum_{k=0}^{N-1} h[k] \, x[n-k]

Each output sample y[n]y[n] is a weighted sum of the current input x[n]x[n] and the previous N1N-1 input samples. The weights are the filter coefficients h[k]h[k]. There are no output feedback terms (no y[nk]y[n-k] on the right side), which is what makes it FIR rather than IIR.

Convolution and FIR filters

The difference equation above is exactly the definition of discrete convolution:

y[n]=x[n]h[n]=k=0N1h[k]x[nk]y[n] = x[n] * h[n] = \sum_{k=0}^{N-1} h[k] \, x[n-k]

Convolution in the time domain corresponds to multiplication in the frequency domain:

Y(ejω)=H(ejω)X(ejω)Y(e^{j\omega}) = H(e^{j\omega}) \cdot X(e^{j\omega})

This duality is what makes FFT-based filtering practical. For long input signals and high-order filters, computing the convolution directly (NN multiplies per sample) becomes expensive. Instead, you can:

  1. FFT the input block and the impulse response
  2. Multiply the spectra pointwise
  3. Inverse FFT to get the output

Overlap-add and overlap-save methods handle the block boundaries. This approach reduces complexity from O(NL)O(N \cdot L) to O(LlogL)O(L \log L) for a block of LL samples.

Frequency response of FIR filters

The frequency response is obtained by evaluating the transfer function on the unit circle, substituting z=ejωz = e^{j\omega}:

H(ejω)=n=0N1h[n]ejωnH(e^{j\omega}) = \sum_{n=0}^{N-1} h[n] \, e^{-j\omega n}

This is a complex-valued function of the angular frequency ω\omega (in radians per sample), and it splits into magnitude and phase components.

Finite duration, 2.2 Finite impulse response (FIR) filter design methods | Digital Filter Design

Magnitude response

The magnitude response gives the filter's gain at each frequency:

H(ejω)=[Re(H(ejω))]2+[Im(H(ejω))]2|H(e^{j\omega})| = \sqrt{[\text{Re}(H(e^{j\omega}))]^2 + [\text{Im}(H(e^{j\omega}))]^2}

This determines the passband (frequencies passed with near-unity gain), the stopband (frequencies attenuated), the cutoff frequency, transition bandwidth, and stopband attenuation depth.

Phase response

The phase response gives the phase shift at each frequency:

H(ejω)=arctan(Im(H(ejω))Re(H(ejω)))\angle H(e^{j\omega}) = \arctan\left(\frac{\text{Im}(H(e^{j\omega}))}{\text{Re}(H(e^{j\omega}))}\right)

For a linear-phase FIR filter, this simplifies to H(ejω)=ωN12\angle H(e^{j\omega}) = -\omega \cdot \frac{N-1}{2}, meaning the group delay is constant at N12\frac{N-1}{2} samples across all frequencies.

FIR filter design methods

Designing an FIR filter means finding the coefficients h[n]h[n] that approximate a desired frequency response while meeting constraints on passband ripple, stopband attenuation, and transition width.

Window method

The window method is the most intuitive design approach:

  1. Start with the ideal (infinite-length) impulse response for your desired frequency response (e.g., an ideal lowpass has a sinc-shaped impulse response).
  2. Truncate it to NN samples.
  3. Multiply by a window function to control the spectral leakage caused by truncation.

The window you choose determines the trade-off between transition bandwidth and stopband attenuation.

Rectangular window

The simplest window: all values equal to 1. It gives the narrowest main lobe (sharpest transition) but the worst sidelobe levels (about 13-13 dB), resulting in poor stopband attenuation. Rarely used in practice for filter design.

Hamming window

w[n]=0.540.46cos(2πnN1),0nN1w[n] = 0.54 - 0.46 \cos\left(\frac{2\pi n}{N-1}\right), \quad 0 \leq n \leq N-1

A widely used window that achieves about 43-43 dB peak sidelobe level and roughly 53-53 dB stopband attenuation. The transition band is wider than the rectangular window, but the stopband behavior is far better.

Hann window

w[n]=0.50.5cos(2πnN1),0nN1w[n] = 0.5 - 0.5 \cos\left(\frac{2\pi n}{N-1}\right), \quad 0 \leq n \leq N-1

Similar to Hamming but with slightly wider main lobe and lower sidelobes (first sidelobe at about 32-32 dB, but sidelobes fall off faster). Stopband attenuation is around 44-44 dB.

Blackman window

w[n]=0.420.5cos(2πnN1)+0.08cos(4πnN1),0nN1w[n] = 0.42 - 0.5 \cos\left(\frac{2\pi n}{N-1}\right) + 0.08 \cos\left(\frac{4\pi n}{N-1}\right), \quad 0 \leq n \leq N-1

Provides excellent stopband attenuation (about 74-74 dB) at the cost of the widest main lobe among these fixed windows. Use it when deep stopband rejection matters more than a sharp transition.

Kaiser window

A parametric window controlled by the parameter β\beta. It's defined using the zeroth-order modified Bessel function of the first kind, I0I_0:

w[n]=I0(β1(2nN11)2)I0(β),0nN1w[n] = \frac{I_0\left(\beta \sqrt{1 - \left(\frac{2n}{N-1} - 1\right)^2}\right)}{I_0(\beta)}, \quad 0 \leq n \leq N-1

The Kaiser window is uniquely flexible: you can specify a desired stopband attenuation and transition width, then compute β\beta and NN using Kaiser's empirical formulas. Higher β\beta gives deeper stopband attenuation but a wider transition band.

Frequency sampling method

This method specifies the desired frequency response at NN equally spaced frequency points, then obtains the filter coefficients via the inverse DFT. You get exact control at the sampled frequencies, but ripples can appear between them. Transition samples (values between 0 and 1 at band edges) are often introduced to reduce these ripples.

Weighted least squares method

This method minimizes the weighted squared error between the desired and actual frequency responses:

minhωW(ω)Hd(ejω)H(ejω)2dω\min_{h} \int_{\omega} W(\omega) \left| H_d(e^{j\omega}) - H(e^{j\omega}) \right|^2 d\omega

The weighting function W(ω)W(\omega) lets you prioritize accuracy in certain bands. For example, you might weight the passband more heavily than the stopband, or vice versa. This yields a least-squares optimal solution but does not guarantee equiripple behavior.

Parks-McClellan algorithm

The Parks-McClellan algorithm (also called the Remez exchange algorithm) designs optimal equiripple FIR filters. Instead of minimizing total squared error, it minimizes the maximum weighted error (Chebyshev criterion):

minhmaxωW(ω)[Hd(ejω)H(ejω)]\min_{h} \max_{\omega} \left| W(\omega) \left[ H_d(e^{j\omega}) - H(e^{j\omega}) \right] \right|

The result is a filter where the approximation error ripples with equal amplitude across both the passband and stopband. This is optimal in the minimax sense: no other filter of the same order can achieve a smaller maximum error. The algorithm iterates using the Remez exchange to find the extremal frequencies where the error peaks.

For a given filter order, Parks-McClellan typically produces sharper transitions than window-based designs.

FIR filter implementation

Once you have the coefficients, you need to implement the filter efficiently. The choice of structure affects latency, numerical precision, and hardware resource usage.

Direct form structure

The most straightforward implementation: it directly computes the difference equation.

  • Uses a tapped delay line: the input passes through N1N-1 delay elements (z1z^{-1})
  • Each delayed sample is multiplied by the corresponding coefficient h[k]h[k]
  • All products are summed to produce the output

Per output sample, this requires NN multiplications and N1N-1 additions. For a linear-phase filter, the coefficient symmetry can be exploited to nearly halve the number of multiplications.

Transposed structure

Obtained by reversing the signal flow graph of the direct form: flip all arrows, swap input and output, replace delays with advances (then re-interpret as delays in the reversed graph).

The transposed form has the same input-output behavior but different internal signal flow. Its advantages:

  • Lower latency — the input is immediately multiplied by all coefficients in parallel, rather than propagating through a delay chain
  • Better numerical properties — round-off errors accumulate differently, often resulting in lower output noise in fixed-point implementations
Finite duration, FIR Filter Frequency Response Matlab Program | ee-diary

Polyphase decomposition

Polyphase decomposition splits the filter into MM subfilters (polyphase components), each operating at a lower rate. The impulse response is partitioned as:

H(z)=k=0M1zkEk(zM)H(z) = \sum_{k=0}^{M-1} z^{-k} E_k(z^M)

where each Ek(z)E_k(z) contains every MM-th coefficient starting from index kk.

This is especially powerful in multirate applications. For decimation by MM, polyphase decomposition lets you filter after downsampling each subfilter's output, reducing the total computation by a factor of MM.

Multirate techniques

Multirate processing changes the sampling rate of a signal:

  • Interpolation by LL: Insert L1L-1 zeros between each sample (upsampling), then apply a lowpass FIR filter with gain LL and cutoff π/L\pi/L to remove imaging artifacts.
  • Decimation by MM: Apply a lowpass FIR filter with cutoff π/M\pi/M to prevent aliasing, then keep every MM-th sample (downsampling).

Polyphase decomposition combined with the noble identities (which allow you to move downsamplers/upsamplers past filters) dramatically reduces computation. Without polyphase, you'd be filtering at the higher rate; with it, each polyphase branch operates at the lower rate.

Comparison of FIR and IIR filters

The choice between FIR and IIR depends on what your application demands. Here's how they compare:

Advantages of FIR filters

  • Exact linear phase is achievable, preserving waveform shape (IIR filters cannot have exactly linear phase)
  • Guaranteed stability with no design effort needed to ensure it
  • Lower sensitivity to coefficient quantization and round-off noise, which matters in fixed-point hardware
  • Constant group delay across all frequencies (for linear-phase designs)
  • Straightforward design using well-understood methods (windowing, Parks-McClellan)

Disadvantages of FIR filters

  • Higher order required for equivalent selectivity: an IIR filter might need order 6 to match what an FIR filter achieves at order 60 or more
  • Greater computational cost per output sample due to the higher order
  • Longer group delay, which can be problematic in real-time control or low-latency audio applications
  • More memory needed to store both the coefficients and the delay line

The rule of thumb: if you need linear phase or guaranteed stability, use FIR. If you need a sharp filter with minimal delay and can tolerate nonlinear phase, IIR may be more efficient.

Applications of FIR filters

Audio signal processing

FIR filters are standard in audio processing because linear phase avoids the phase smearing that can color the sound. Common uses include graphic and parametric equalizers, crossover networks in loudspeaker systems, noise reduction, and echo cancellation. The constant group delay ensures that transients (like drum hits) maintain their shape.

Image processing

Two-dimensional FIR filters operate on image pixels using a coefficient matrix (kernel). Examples include Gaussian smoothing (blurring), Laplacian kernels for edge detection, and unsharp masking for sharpening. The 2D convolution is separable for many common kernels, meaning a 2D filter can be decomposed into two 1D filters applied sequentially (rows then columns), reducing computation significantly.

Biomedical signal processing

Physiological signals like ECG, EEG, and EMG are often contaminated by noise and artifacts. FIR filters are used for:

  • Lowpass filtering to remove high-frequency muscle noise from ECG
  • Highpass filtering to eliminate baseline wander (slow drift) in ECG
  • Bandpass filtering to isolate specific brain rhythms in EEG (e.g., alpha band: 8-13 Hz)

Linear phase is particularly important here because phase distortion can alter waveform morphology, leading to incorrect clinical interpretation.

Radar signal processing

FIR filters appear in radar for matched filtering (maximizing signal-to-noise ratio for a known transmitted waveform), pulse compression (improving range resolution without increasing peak power), and moving target indication (MTI) filters that suppress returns from stationary clutter while passing Doppler-shifted returns from moving targets.