Fir filter

In signal processing, a finite impulse response (FIR) filter is a filter whose impulse response (or response to any finite length input) is of finite duration, because it settles to zero in finite time. This is in contrast to infinite impulse response (IIR) filters, which may have internal feedback and may continue to respond indefinitely (usually decaying).

The impulse response of an Nth-order discrete-time FIR filter (i.e., with a Kronecker delta impulse input) lasts for N + 1 samples, and then settles to zero.

FIR filters can be discrete-time or continuous-time, and digital or analog.


The output y of a linear time invariant system is determined by convolving its input signal x with its impulse response b.

For a discrete-time FIR filter, the output is a weighted sum of the current and a finite number of previous values of the input. The operation is described by the following equation, which defines the output sequence y[n] in terms of its input sequence x[n]:

y[n] &= b_0 x[n] + b_1 x[n-1] + \cdots + b_N x[n-N] \\
     &= \sum_{i=0}^{N} b_i x[n-i]



  • \scriptstyle x[n] is the input signal,
  • \scriptstyle y[n] is the output signal,
  • \scriptstyle b_{i} are the filter coefficients, also known as tap weights, that make up the impulse response,
  • \scriptstyle N is the filter order; an \scriptstyle Nth-order filter has \scriptstyle (N \,+\, 1) terms on the right-hand side. The \scriptstyle x[n-i] in these terms are commonly referred to as taps, based on the structure of a tapped delay line that in many implementations or block diagrams provides the delayed inputs to the multiplication operations. One may speak of a 5th order/6-tap filter, for instance.


An FIR filter has a number of useful properties which sometimes make it preferable to an infinite impulse response (IIR) filter. FIR filters:

  • Require no feedback. This means that any rounding errors are not compounded by summed iterations. The same relative error occurs in each calculation. This also makes implementation simpler.
  • Are inherently stable. This is due to the fact that, because there is no required feedback, all the poles are located at the origin and thus are located within the unit circle (the required condition for stability in a discrete, linear-time invariant system).
  • They can easily be designed to be linear phase by making the coefficient sequence symmetric. This property is sometimes desired for phase-sensitive applications, for example data communications, crossover filters, and mastering.

The main disadvantage of FIR filters is that considerably more computation power in a general purpose processor is required compared to an IIR filter with similar sharpness or selectivity, especially when low frequency (relative to the sample rate) cutoffs are needed. However many digital signal processors provide specialized hardware features to make FIR filters approximately as efficient as IIR for many applications.

Impulse response

The impulse response \scriptstyle h[n] can be calculated if we set \scriptstyle x[n] \;=\; \delta[n] in the above relation, where \scriptstyle \delta[n] is the Kronecker delta impulse. The impulse response for an FIR filter then becomes the set of coefficients \scriptstyle b_n, as follows

h[n] = \sum_{i=0}^{N}b_i \delta[n-i] = b_n

for \scriptstyle n \;=\; 0 to \scriptstyle N.

The Z-transform of the impulse response yields the transfer function of the FIR filter


 H(z) &= Z\{h[n]\}  \\
      &= \sum_{n=-\infty}^{\infty} h[n] z^{-n}  \\
      &= \sum_{n=0}^{N}b_n\,z^{-n}


FIR filters are clearly bounded-input bounded-output (BIBO) stable, since the output is a sum of a finite number of finite multiples of the input values, so can be no greater than \scriptstyle \sum |b_i| times the largest value appearing in the input.

Filter design

To design a filter means to select the coefficients such that the system has specific characteristics. The required characteristics are stated in filter specifications. Most of the time filter specifications refer to the frequency response of the filter. There are different methods to find the coefficients from frequency specifications:

  1. Window design method
  2. Frequency Sampling method
  3. Weighted least squares design
  4. Parks-McClellan method (also known as the Equiripple, Optimal, or Minimax method). The Remez exchange algorithm is commonly used to find an optimal equiripple set of coefficients. Here the user specifies a desired frequency response, a weighting function for errors from this response, and a filter order N. The algorithm then finds the set of \scriptstyle (N \,+\, 1) coefficients that minimize the maximum deviation from the ideal. Intuitively, this finds the filter that is as close as you can get to the desired response given that you can use only \scriptstyle (N \,+\, 1) coefficients. This method is particularly easy in practice since at least one text[1] includes a program that takes the desired filter and N, and returns the optimum coefficients.
  5. Equiripple FIR filters can be designed using the FFT algorithms as well.[2] The algorithm is iterative in nature. You simply compute the DFT of an initial filter design that you have using the FFT algorithm (if you don't have an initial estimate you can start with h[n]=delta[n]). In the Fourier domain or FFT domain you correct the frequency response according to your desired specs and compute the inverse FFT. In time-domain you retain only N of the coefficients (force the other coefficients to zero). Compute the FFT once again. Correct the frequency response according to specs.

Software packages like MATLAB, GNU Octave, Scilab, and SciPy provide convenient ways to apply these different methods.

Some filter specifications refer to the time-domain shape of the input signal the filter is expected to "recognize". The optimum matched filter for separating any waveform from white noise is obtained by sampling that shape and using those samples in reverse order as the coefficients of the filter — giving the filter an impulse response that is the time-reverse of the expected input signal.

Window design method

In the window design method, one first designs an ideal IIR filter and then truncates the infinite impulse response by multiplying it with a finite length window function. The result is a finite impulse response filter whose frequency response is modified from that of the IIR filter. Multiplying the infinite impulse by the window function in the time domain results in the frequency response of the IIR being convolved with the frequency response of the window function. If the window's main lobe is narrow, then the frequency response resulting FIR filter will be close to that of the ideal IIR filter.

If the ideal response is sufficiently simple, such as rectangular, the result of the convolution can be relatively easy to determine. In fact one usually specifies the desired result first and works backward to determine the appropriate window function parameter(s). Kaiser windows are particularly well-suited for this method because of their closed form specifications.

Moving average example

Fig. (a) Block diagram of a simple FIR filter (2nd-order/3-tap filter in this case, implementing a moving average)
Fig. (b) Pole-Zero Diagram
Fig. (c) Amplitude and phase responses

A moving average filter is a very simple FIR filter. It is sometimes called a boxcar filter, especially when followed by decimation. The filter coefficients, \scriptstyle b_0,\, \dots,\, b_N, are found via the following equation:


To provide a more specific example, we select the filter order:

N = 2

The impulse response of the resulting filter is:

h[n] = \frac{1}{3}\delta[n] + \frac{1}{3}\delta[n-1] + \frac{1}{3}\delta[n-2]

The Fig. (a) on the right shows the block diagram of a 2nd-order moving-average filter discussed below. To discuss stability and spectral topics we take the z-transform of the impulse response:

H(z) = \frac{1}{3} + \frac{1}{3}z^{-1} + \frac{1}{3}z^{-2} = \frac{1}{3}\frac{z^{2} + z + 1}{z^{2}}

Fig. (b) on the right shows the pole-zero diagram of the filter. Zero frequency (DC) corresponds to (1,0), positive frequencies advancing counterclockwise around the circle to (-1,0) at half the sample frequency. Two poles are located at the origin, and two zeros are located at \scriptstyle z_{1} \;=\; -\frac{1}{2} \,+\, j\frac{\sqrt{3}}{2}, \scriptstyle z_{2} \;=\; -\frac{1}{2} \,-\, j\frac{\sqrt{3}}{2}.

The frequency response, for frequency ω in radians per sample, is:

H\left(e^{j\omega}\right) = \frac{1}{3} + \frac{1}{3}e^{-j\omega} + \frac{1}{3}e^{-j2\omega}

Fig. (c) on the right shows the magnitude and phase plots of the frequency response. Clearly, the moving-average filter passes low frequencies with a gain near 1, and attenuates high frequencies. This is a typical low-pass filter characteristic. Frequencies above π are aliases of the frequencies below π, and are generally ignored or filtered out if reconstructing a continuous-time signal. The following figure shows the phase response. Since the phase always follows a straight line except where it has been reduced modulo π radians (should be 2π), the linear phase property is demonstrated.

See also


External links

  • Connexions online book by John Treichler (2008).
  • FIR FAQ provided by
  • BruteFIR; Software for applying long FIR filters to multi-channel digital audio, either offline or in realtime.
  • Freeverb3 Reverb Impulse Response Processor
  • Worked examples and explanation for designing FIR filters using windowing. Includes code examples.
  • A JAVA applet with different FIR-filters; the filters are applied to sound and the results can be heard immediately. The source code is also available.
  • Matlab code; Matlab code for "Equiripple FIR filter design by the FFT algorithm" by A. Enis Cetin, O. N. Gerek and Y. Yardimci, IEEE Signal Processing Magazine, 1997.
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.