# FIR Filters

Finite Impulse Response (FIR) filters are such digital filters which have - as the name suggests - a finite impulse response. These filters do not have an internal feedback and can be applied simply by convolving an input sequence $x[n]$ with the filter's impulse response $h[n]$ to get the output sequence $y[n]$:

For FIR filters, the impulse response $h[n]$ is a one-dimensional array containing the $N$ filter coefficients. The following example shows the coefficients, respectively the impulse response for a filter of the order $N=5$:

### The Difference Equation¶

From the impulse response we can get the coefficients $b_n$ to write the difference equation, which is the basis for applying a filter:

$$y[n] = b_0 x[n] + b_1 x[n-1]+ b_2 x[n-2]+ b_3 x[n-3]+ b_4 x[n-4] + b_5 x[n-5]$$

### Implementation Structure¶

Another important representation of a filter is the implementation structure. It can be directly derived from the difference equation. Each $z^{-1}$ block represents a delay by one sample. This case shows the direct form:

### Applying a Filter by Convolution¶

Applying the filter with the given impulse response is done by simple convolution, which is the same as passing samples from the input of the implemtation structure above to its output. The above equation is then written as follows:

$$\begin{eqnarray} y[m] &=& x[n] * h[m]\\ &=& \sum\limits_{m=0}^{M} h[m] x(n-m)\\ &=& \sum\limits_{m=0}^{M} b_m x(n-m)\\ \end{eqnarray}$$

### The Transfer Function¶

The difference equation can also be expressed as a sum:

$$h[n] = \sum\limits_{n=0}^{N} b_n x[n-1]$$

The transfer function of the filter can be obtained via the z-transform:

$$H[z] = \sum\limits_{n=0}^{N} h[n] z^{-n}$$$$H(z) = 0.5 z^{-2} + z^{-3} + 0.5 z^{-4}$$

In the next step, all exponents are shifted by expanding with $z^{4}$:

$$H(z) = \frac{z^2 + 2z + 1}{z^4}$$

Factor the denominator to find its roots:

$$H(z) = \frac{(z+1)(z+1)}{z^4}$$

There is a double zero at $\mathbf{z=-1}$. As all causal FIR filters it has $N=4$ poles at the origin $z=0$.

With $z=e^{j\omega}$ the complex roots can be obtained:

$$Z = (e^{-i\omega} +1)(e^{-i\omega} +1)$$

## In the Unit Cirlce¶

An LTI system can be visualized in the z-plane by plotting the zeros, respectively the roots of its impulse response.

### Frequency Response¶

The frequency response of the filter