Hello! Welcome to your final lesson in this module on digital filter design.
In our previous lessons, we've focused exclusively on Finite Impulse Response (FIR) filters, culminating in the powerful Parks-McClellan algorithm for designing optimal equiripple filters. We saw that FIR filters can provide perfect linear phase and are always stable. However, as we briefly noted, they often come at a high computational cost.
Today, we will broaden our perspective and conduct a crucial comparison. The choice between an FIR filter and its counterpart, the Infinite Impulse Response (IIR) filter, is one of the most fundamental design decisions in digital signal processing. Our goal is to analyze the trade-offs between IIR and FIR filters in terms of phase linearity, stability, and computational complexity.
Understanding these trade-offs will equip you to select the right tool for the right job, a critical skill for any signal processing engineer.
This lesson will cover:
- A brief review of the structural differences that define FIR and IIR filters.
- A detailed analysis of the three core trade-offs: phase, stability, and complexity.
- Practical implications of these trade-offs, especially in finite-precision hardware.
- A summary framework to guide your design choices.
1. Foundational Differences: Recursion vs. Non-Recursion
The names "Finite Impulse Response" and "Infinite Impulse Response" point directly to the core structural difference between these two filter types. This difference is best understood by looking at their difference equations and system functions.
To start, please watch this excellent overview video. It will formalize the concepts we're about to discuss.
Overview of FIR and IIR Filters
This video from Barry Van Veen's channel, 'Overview of FIR and IIR Filters,' clearly contrasts the difference equations, system functions, and block diagrams of the two filter types. It provides a solid foundation for our analysis.
Please watch from the beginning to 06:19. Pay attention to: How the IIR difference equation includes past output values (feedback/recursion). How this recursion leads to a transfer function, H(z), with both a numerator and a denominator polynomial (poles and zeros), whereas the FIR filter's transfer function is just a numerator polynomial (only zeros).
As the video explains, the key distinction is recursion:
-
FIR filters are non-recursive. The output is a weighted sum of only current and past input values, .
Their impulse response is finite because once the input impulse passes through the filter's delay line (of length ), the output becomes zero and stays zero. -
IIR filters are recursive. The output depends on past inputs and past outputs.
The feedback loop means that even a single input impulse can theoretically produce an output that continues forever, decaying over time—hence, an infinite impulse response.
This single structural difference—the presence of feedback—is the root cause of all the trade-offs we will now explore.
2. Trade-off 1: Phase Linearity
This is often the most critical factor in choosing a filter type.
Linear phase means that all frequency components of the input signal are delayed by the same amount of time as they pass through the filter. This results in a constant group delay. The practical consequence is that the filter preserves the shape of the signal in the time domain, simply shifting it in time.
-
FIR filters can have perfect linear phase. This is achieved by making their impulse response coefficients symmetric or anti-symmetric. A non-causal impulse response like a sinc function is symmetric, and when we truncate and window it, we create a finite, causal, symmetric impulse response. The feedforward-only structure of an FIR filter can easily implement this.
-
IIR filters have non-linear phase. The recursive nature of an IIR filter means its impulse response must be causal and one-sided (it cannot be symmetric about its center). Because the design methods for IIR filters (which we'll see in the next module) are based on transforming analog prototypes, they prioritize achieving a specific magnitude response. The phase response is an unavoidable side effect of the pole and zero locations required for that magnitude response.
To see the practical impact of this, the next video provides a fantastic demonstration.
9. Understanding Linear Phase - Digital Filter Basics
The video 'Understanding Linear Phase' by Akash Murthy vividly demonstrates how non-linear phase distorts a signal's waveform. It's one thing to discuss this theoretically; it's another to see it.
Watch from the beginning to 15:06. The video is broken down as follows: (0:00-6:05): Explains the concept of linear phase, constant group delay, and why only FIR filters can inherently have it due to impulse response symmetry. (6:05-12:22): A practical demo showing how a sharp IIR (Chebyshev) filter, while effective in the frequency domain, distorts the time-domain waveform. (12:22-15:06): The same demo with an FIR filter, showing that the waveform is preserved, just delayed. It concludes by visually comparing the impulse responses.
As the video highlights, whether this phase distortion matters depends on the application.
- In audio processing, the human ear is largely insensitive to phase, so the computational efficiency of IIR filters often makes them the preferred choice for equalizers.
- In data communications, medical imaging (like ECG), or control systems, preserving the waveshape is critical to avoid distorting the information contained in the signal. In these cases, the linear phase of an FIR filter is essential.
3. Trade-off 2: Computational Complexity
For a given set of frequency-selective specifications (e.g., passband ripple, stopband attenuation, and transition width), the difference in complexity is stark.
- IIR filters are highly efficient. Their feedback mechanism allows them to create very sharp frequency responses with a very low filter order. The poles, which can be placed close to the unit circle, are powerful tools for shaping the frequency response with few coefficients.
- FIR filters are computationally expensive. Without poles, they must rely on a large number of zeros (taps) to "brute force" a sharp frequency response.
Let's ground this with some practical numbers.
FIR vs IIR Filters - A Practical Comparison
The article 'FIR vs IIR Filters - A Practical Comparison' from Wireless PI provides excellent, practice-oriented explanations. We'll start with its discussion on complexity.
Please read the first section, 'Computational Complexity'. It explains the intuition behind why IIR filters are more efficient and provides Fred Harris's well-known rule-of-thumb for estimating FIR filter order.
The key insight is that the feedback in an IIR filter allows past outputs, which contain a "summary" of even older inputs, to be reused. An FIR filter has no such memory mechanism beyond its explicit delay line.
As stated in the first video from Barry Van Veen, it's not uncommon for a spec to require an FIR filter of order 100 or more, while a corresponding IIR filter might only need an order of 8 or 10. This means fewer coefficients to store, and far fewer multiplications and additions per output sample, leading to lower power consumption and the ability to run on less powerful hardware.
4. Trade-off 3: Stability
This is another area where the two filter types differ fundamentally, especially when considering real-world implementation.
Theoretical Stability
- FIR filters are always stable. Their transfer function has only trivial poles at . Since the impulse response is finite, the output for any bounded input will always be bounded (BIBO stability). You don't need to check for stability when designing an FIR filter.
- IIR filters can be unstable. They have poles that can be located anywhere. For a causal IIR filter to be stable, all its poles must lie inside the unit circle of the z-plane. This is a critical design constraint.
Practical Stability (Finite Precision Effects)
In a real DSP, coefficients and signals are represented with a finite number of bits. This is where the recursive nature of IIR filters introduces significant challenges that don't affect FIR filters.
FIR vs IIR Filters - A Practical Comparison
Let's return to the article 'FIR vs IIR Filters - A Practical Comparison' to understand these practical issues. This will resonate with your EE background, as it deals with the consequences of implementation in hardware.
Please read the sections 'Stability and Finite Precision Arithmetic', 'Overflow Oscillations', and 'Limit Cycles'. Focus on how the feedback loop in IIR filters causes these three distinct problems.
Let's summarize the key points from that reading:
- Coefficient Quantization: When you quantize IIR filter coefficients to fit them into finite-precision hardware, the pole locations can shift. It's possible for poles designed to be just inside the unit circle to move onto or outside it, making a theoretically stable filter unstable in practice. FIR filters don't have this failure mode.
- Quantization Noise Amplification: Arithmetic operations (like multiplication) produce results that must be rounded or truncated. This introduces small errors (quantization noise) at each step. In an IIR filter, this noise is fed back into the system. If the filter has poles close to the unit circle (which is common for filters with sharp roll-offs), the noise gets amplified by the filter's own high gain at those frequencies.
- Overflow and Limit Cycles: In fixed-point arithmetic, if a calculation exceeds the maximum representable value, it "wraps around" (overflow). In an IIR filter, this large error is fed back, which can cause large, sustained oscillations. Limit cycles are a related phenomenon where small quantization errors are fed back, causing the filter output to oscillate around a small value indefinitely, even when the input is zero. FIR filters, with no feedback, simply produce a zero output after the initial transient when the input is zero.
Test your understanding!
You are designing a filter for a low-power, fixed-point microcontroller. The filter needs a very sharp transition band. The signal is an audio signal for a music effects processor. Based on the trade-offs, would you lean towards FIR or IIR, and why? What would be your main implementation concern?
Show answer
You would lean towards an IIR filter.
- Reasoning: The application is audio, where non-linear phase is generally acceptable. The primary constraints are a "very sharp transition band" and "low-power," which points directly to the computational efficiency of IIR filters. An FIR filter meeting a sharp spec would likely be too computationally intensive for the microcontroller.
- Main Concern: The main concern would be practical stability in the fixed-point environment. You would need to be very careful with coefficient quantization to ensure the poles remain inside the unit circle. You would also need to analyze the potential for quantization noise amplification and implement the filter structure (e.g., using second-order sections) and arithmetic (e.g., with saturation logic to prevent overflow) in a way that avoids limit cycles and overflow oscillations.
5. Summary and Decision Framework
We can summarize the core trade-offs in a table.
| Feature | FIR Filter | IIR Filter |
|---|---|---|
| Phase Linearity | Pro: Can have perfect linear phase. Preserves signal waveshape. | Con: Inherently non-linear phase. Distorts waveshape. |
| Stability | Pro: Always stable, both theoretically and practically. Robust. | Con: Can be unstable. Sensitive to coefficient quantization and prone to finite-precision errors. |
| Complexity | Con: High order for sharp specs. High computational cost and latency. | Pro: Low order for sharp specs. Very computationally efficient. |
| Design | Pro: Flexible, optimization-based methods. Can design arbitrary shapes. | Con: Methods based on analog prototypes. Limited to standard frequency-selective types. |
This table provides a clear framework for making a design choice:
-
Choose FIR when:
- Linear phase is required (communications, image processing, data analysis).
- Robustness and guaranteed stability are paramount.
- Computational resources are plentiful.
-
Choose IIR when:
- Computational efficiency and low latency are the primary concerns.
- Phase linearity is not critical (many audio applications).
- You are implementing a standard filter type (lowpass, highpass, etc.).
Conclusion
In this lesson, we have conducted a comprehensive analysis of the trade-offs between FIR and IIR filters. You now understand that the choice is not about which is "better" overall, but which is better for a specific application's constraints. This decision revolves around a central compromise: the elegance, stability, and linear phase of FIR filters versus the raw computational efficiency of IIR filters.
Key Takeaways:
- The recursive structure of IIR filters gives them high computational efficiency at the cost of non-linear phase and potential stability issues in finite-precision implementations.
- The non-recursive structure of FIR filters grants them perfect linear phase and unconditional stability at the cost of much higher computational complexity and memory for a given magnitude specification.
- The three key decision criteria are phase linearity, stability (especially practical stability), and computational complexity.
Preview of the Next Module:
This lesson concludes our module on digital filter design. We have now covered the design of both FIR filters (windowing, frequency sampling, optimal) and IIR filters (impulse invariance, bilinear transform), and we've analyzed their trade-offs.
You've learned that most IIR filter designs are derived from classic analog filter prototypes. To truly understand these methods, we must first understand the analog systems themselves. Therefore, our next module, "System Analysis in the s-Domain," will take a step back into the continuous-time world. We will begin by exploring the historical development and mathematical derivation of the Laplace transform, the essential tool for analyzing analog LTI systems and the foundation upon which IIR filter design is built. This will connect directly with your existing knowledge of control systems and differential equations.