A finite impulse response filter or FIR filter is a simple filter commonly used in DSP (Digital Signal Processing) applications.

A FIR filter is characterised by its length, or number of taps, which we shall call n; by a set of n coefficients (also known as taps), which are constant and define the filter; and by a set of n state variables, which will generally change with each value passed through the filter.

Mathematically, applying an FIR filter to a signal is equivalent to the convolution of the signal with the filter coefficients. This means that with an n-coefficient filter, any input value has an effect on n output values (assuming the final coefficient is non-zero). This is why it is called a finite filter: the impulse response (the output produced by a single non-zero input in a stream of zeros) has a finite length and a finite number of non-zero outputs.

FIR filters are used for a number of purposes in DSP, such as for low or high-pass filters. Although they tend to be larger than other filters such as infinite impulse response (IIR) filters, they are computationally very simple, making them ideal for implementation on DSP processors. Also, because they are finite, and their impulse response equals the filter coefficients, it is easy to calculate coefficients. There is no risk of feedback amplifying the results of rounding errors, which can make the design of infinite impulse response filters difficult.

The basic algorithm for an fir filter of length n, acting on a single input value input with its coefficients in array coef and state data in array state is (expressed as a C function).

int fir(int input, int n, int coef[], int state[]) {
    int sum, i;

    for (i=n-1; i>0; i--) state[i] = state[i-1];
    state[0] = input; 

    sum = 0;
    for (i=0; i<n; i++) sum += coef[i] * state[i];

    return sum;

Log in or register to write something here or to contact authors.