Iowa Hills Software   Digital and Analog Filters 
Differences Between FIR Filters and IIR Filters      Home

If you found this web page because you Googled "the difference between FIR and IIR", then it is likely you have already seen numerous other web pages on this subject and you are still trying to get a clear answer to your question. So lets start by with a clear advantage that FIR has over IIR.

Because of the way FIR filters can be synthesized, virtually any filter response you can imagine can be implemented in an FIR structure as long as tap count isn't an issue. For example, Butterworth and Chebyshev filters can be implemented in FIR, but you may need a large number of taps to get the desired response. So we generally use prototypes other than the s domain polynomials as prototypes for FIR filters. As another example, if you want a band pass filter with two pass bands, or a band pass filter with specific phase properties, an FIR can do the job with no problem.

IIR filters on the other hand are essentially restricted to the well defined responses that can be achieved from the s domain polynomials such as the Butterworth. It is quite difficult to synthesize a user defined filter in an IIR structure.

It is quite possible however that the most important difference between an IIR and FIR isn't the filter itself, but rather how the filter is implemented. The beauty of FIR filters, and quite possibly their most important feature, is that they can be implemented with integer math. As you are surely aware, everyone wants small, low power, low cost, portable devices. These devices typically use a processor similar to the Texas Instruments MSP430, or an FPGA, or an ASIC.

These types of processors work great and are as common as dirt, but seldom have a floating point math core. Integer math is the standard because its easy, cheap, fast, and low power. (Floating point math is then done in code, which is very slow.) So the only reasonable way to implement a digital filter in one of these devices is to use FIR. Thus it is the hardware, not the characteristics of the filter that determines whether FIR or IIR will be used.

IIR filters can't be implemented in integer math because the IIR coefficients can't be scaled to integer values without having the filter's math calculations explode (the problem is with the feedback coefficients). For example, scaling the coefficients by 16, which won't create nearly enough significant digits for filtering, will cause the calculations to go exponential. Try it.

The rest of this page shows some of the basic differences between an FIR and IIR filters. In the first plot below, we compare the frequency responses of a12 pole Butterworth IIR and a typical FIR filter (with emphasis on the word typical). The reader should understand that if we want to, we can implement the 12 pole Butterworth as an FIR and obtain an identical response, but that isn't typically done simply because of the excessive number of taps required to achieve the Butterworth response in an FIR.

These two filters have comparable magnitude responses. Notice the differences in the knee of the pass band at Omega = 0.2. In general, an IIR filter will have a sharper knee than a comparable FIR filter. Also, the slope of IIR filter's transition band will be 6 dB / octave / pole. A typical FIR transition band slope changes with frequency as shown here (again, emphasis on the word typical).

This FIR requires 50 multiplies + 50 adds while the IIR requires 30 multiplies + 36 adds for its 6 second order sections. The FIR has a constant group delay of 24.5 (equal to (NumTaps-1)/2 ) while the IIR has a much lower, but non-constant group delay.

FIR Filter and  IIR Filter Response Comparison

 

Step Response and Delay

The group delay and impulse response are the most basic differences between an FIR and IIR filter. An IIR filter has, at least in principle, an infinitely long impulse response while an FIR filter's impulse response is as long as its tap count. If an infinitely long impulse response sounds problematic, remember that all analog filters have the same type of response.

Closely related to the impulse response is the filter's step response. This next plot shows the step response for the two filters above. It shows the amount of time for a pulse to propagate through the filter (time is in samples). Note that the pulse is delayed more in the FIR than the IIR. This is fairly typical. Compare these delay times with the group delay values plotted above.

FIR Filter and  IIR Filter Step Response Comparison

The amount of overshoot and ringing is an important difference between these two step responses. However, this difference has nothing to do with whether the filter is an IIR or FIR. The IIR filter shown here is a 12 pole Butterworth. A 12 pole Butterworth implemented as an FIR would have an identical step response.

Having said this, it is important to remember that the amount of overshoot in the step response is a function of the filter's group delay characteristics, and the slope of the filter's transition band. We chose to show typical FIR and IIR filters here. FIR filters typically have a constant group delay, which will reduce the amount of ringing and overshoot in the step response. However, we could have shown an IIR Bessel filter, which would have almost no overshoot or ringing.

Just to be clear, if the magnitude responses are similar, then an FIR will typically have less overshoot and ringing because it typically has better group delay characteristics than the IIR.

Impulse Response

Here are the impulse responses for the two filters above (this time scale is different than the step response plot above). Again, the FIR could have had the same impulse response as the IIR, but we are showing a typical FIR filter. The typical FIR filter's impulse response is centered at (N-1)/2 and is symmetric about the center. The typical IIR impulse response starts sooner, and ends later. Again, the difference in ringing has nothing to do with IIR or FIR, but rather the prototype used to synthesize the filter.

It may be of interest to the reader that the impulse response of a12 pole Butterworth filter implemented in an opamp circuit would have the same characteristics as this IIR digital filter.

FIR Filter and IIR Filter Impulse Response Comparison

Stability

An important difference between IIR and FIR filters is the potential for the IIR filter to be unstable. An FIR filter will be stable no matter how it is synthesized or implemented (it has no feedback). On the other hand, an IIR filter with improperly placed poles can't be made stable no matter how it is implemented. Please remember however that OpAmp filters are the same as IIR filters in this respect. Both IIR and OpAmp filters need to be carefully synthesized and implemented or they risk being unstable.

So, how difficult is it to get a stable IIR filter designed and implemented? The following link discusses the stability of the IIR filters synthesized by our free IIR filter program. It discusses IIR filter pole locations, compares the frequency response of IIR filters to known stable filters, and shows a method by which the engineer can assess the margin of stability the IIR filter has.  IIR Filter Stability

Math Register Size

For the sake of comparing an FIR to an IIR, we will assume we are using a fixed point processor. Both the number of bits to left and to the right of the decimal place are important. The number of bits to the right determine the maximum attenuation one is able to achieve with the filter. The number of bits to the left determine the register's maximum value (overflow must never occur).

An important difference between FIR and IIR filters is the peak math values generated by the filter as a signal is processed. Because of the overshoot in the filters step response, square waves typically create the largest math values in a filter.

For the two filters shown on this page, the peak math register value for the FIR is only 1.3, and this is fairly typical of an FIR filter. In fact, FIR filters never generate math values greater than 2 (for a signal with ±1 amplitude and unity filter gain).

IIR filters are quite different in this respect. The IIR filter shown above has a peak math value of 6.5 while filtering a square wave, but there is no such thing as a typical peak math value for IIR filters. They can range from 1.0 to 10,000 or even higher. The filter's peak math value is a strong function of the polynomial it is based on and its selectivity. The more selective the filter, the higher the math values. If working with relatively low distortion filters (moderate selectivity), you can expect the peak math value to be less than 32, but even this small value would require 4 more bits than an FIR filter.

Implementation Structures

An important difference between IIR and FIR filters is in the implementation structure. FIR filters are usually implemented as Nth order polynomials. IIR filters on the other hand, can be implemented this way, but only if a floating point processor is available. If using a fixed point processor, an IIR filter must be implemented as a series of second order sections (biquads).

The reason for this lies with the magnitude of the math values generated by the filter, which we show in the following table. If using fixed point, the larger math values require more register bits to prevent overflow, which is strictly forbidden. Here we give the peak math values for an IIR filter implemented both ways. For example, if implemented in 2nd order sections, the Butterworth filter needs 3 integer bits to prevent overflow, but would require 18 integer bits if implemented as an Nth order poly. The number of fractional bits required would be the same in both cases. (Integer bits are needed to accommodate math values greater than 1, while the fractional bits are needed to achieve the desired stop band performance. These are completely separate problems.)

12 Pole Filter Types  2nd Order Peak Math Nth Order Peak Math
Butterworth Low Pass 6.5 (3 bits) 194,806  (18 bits)
Cheby Low Pass 0.2 dB Ripple 94.3 (7 bits) 120,684,358 (27 bits)
Butterworth Band Pass 13.9 (4 bits) 6.134E14 (50 bits)
Cheby Band Pass 0.2 dB Ripple 44.9 (6 bits) 1.982E29  (98 bits)
     

IIR Diagram.png

It should be obvious that except for the denominator, IIR and FIR structures are identical.

To summarize, an FIR filter is almost always implemented as an Nth order poly. It can be implemented in 2nd order sections, but there is no need to and finding the polynomial's N roots is numerically difficult because of their close proximity to one another.

An IIR filter can be implemented either way if using floating point. If using fixed point however, an IIR filter must be implemented in 2nd order sections because of practical hardware considerations.

The Example FIR IIR C Code page gives code examples for implementing both FIR and IIR filters.

 

IIR Zero Input Limit Cycles

IIR filters differ from FIR filters in that some IIR filters can suffer from a phenomenon known as Zero Input Limit Cycles. This is a problem related to register size where the IIR filter is unable to clear its registers and its output can't settle at zero after the input goes to zero. The filter's output may oscillate indefinitely because a small residual signal continues to circulate within the filter.

Of course, an ideal IIR filter's output will never settle at zero in theory, but this is only true if the registers have infinite precision. The truncation caused by limited register size will limit the length of the filters impulse response and should also prevent limit cycles. Notch and high pass IIR filters are most susceptible to this problem and will require extra register bits to prevent this phenomenon from occurring.

 

Pole Zero Locations

If you are somewhat new to filter design, you may be wondering how the filter's pole zero locations affect the filter's response.

Here we show the pole zero locations for a 5 pole Inverse Chebyshev low pass implemented in both IIR and FIR. Note the pole zero locations with respect to the filter's corner frequency. Also note how the 5 IIR zero locations are maintained in the FIR implementation.

As shown on the left, the FIR response is slightly different than the IIR response, but this difference diminishes to zero as the tap count is increased. The slight difference in the 5 zero locations on the unit circle also diminishes to zero as the tap count is increased.

5 Pole Inv Cheb Pole Zeros.png

Here is a more typical zero plot for an FIR filter. All of its stop band zeros are on the unit circle. Again, note the 14 zeros on the unit circle and the 14 nulls in the response.

Since this is a linear phase filter, the pass band zeros come in sets of 2 and 4. A zero on the real axis has a counterpart on the axis reflected about the unit circle. If not on the real axis, the zeros come in a set of four, reflected about the axis and reflected about the unit circle. It should be noted that this filter has a zero at the origin that isn't shown.

FIR Zero Plot

 

Apples and Oranges ?????

In general, trying to compare an IIR filter to an FIR filter is a bit like comparing apples to oranges. However, since we can implement an analog filter as an FIR, lets try to make a comparison using a data filter example.

Here we implement a 12 pole Adjustable Gauss filter with gamma = 0, which has a response midway between a Gauss and Butterworth. The responses for both the IIR and FIR are shown here.

As can be seen, there is little difference in the performance of these two filters. The FIR requires 36 Multiply/Adds while the IIR requires 30 Multiply/Adds plus 6 adds, so the difference here is also negligible, except that the FIR can be done using integer math. So, for this particular filter, there is very little difference between an FIR and IIR filter.

12 Pole Adj Gauss FIR Filter and 12 Pole Adj Gauss IIR Filter Comparison

12 Pole FIR Filter and 12 Pole IIR Filter Response Comparison

The point of this example was to make it clear that in terms of performance, the difference between an FIR and IIR can be minimal. This is especially true when a polynomial such as the Bessel, Gauss, or Inverse Chebyshev is used as the FIR prototype. For more discussion on this, see Polynomial FIR Filters.   

To summarize, an IIR filter is neither better or worse than an FIR filter. Each has its place and the project's overall requirements will determine which is the better solution.

This web site is intended for engineers who are not experts in filter design, but still need to implement a good filter, whether it be analog or digital. The programs here are free, and I give examples of implementation code for the digital filters, and implementation tips for the analog filters. Ultimately however, you have to dig in and work with this stuff to learn it.

Home Page    IIR Filter Page    FIR Filter Page   Download Page.  

Copyright 2013  Iowa Hills Software