Finite impulse response (FIR) filter

Introduction

Finite impulse response filters are the most basic types of filters. They simply weigh different delayed inputs in order to calculate the output. Because of this simplicity, this filter structure allows for a thorough analysis.



Module overview

This module will cover the following topics:

  1. Difference equation [⯈] - The difference equation is the mathematical description of an FIR filter. It describes the relationship between the input and output samples.
  2. Convolution [⯈] - The output of an FIR filter can be calculated using the convolution operation.
  3. Linear time invariant [⯈] - The FIR filter, as described in the previous sections, belongs to a general class of systems that is used very often in practice.



Exercises

In this section several exercises are available, including their answers. The exercises marked in blue are explained by means of more extensive pencast videos.

Video quiz

Given the signal $x[n]$ below:
$x[n] = \begin{cases}0 & \text{for } n \text{ even} \\ 1 &\text{for } n \text{odd}\end{cases}$
The Difference Equation (DE) is given as:
$y[n] = x[n] + x[n-1] + x[n-2]$
Calculate $y[n]$ for $n$ even and $n$ odd.









Given the impulse response of an LTI system:
$h_1[n] = \delta [n] + \delta[n-1] - \delta[n-2]$
Let the input of this system be the unit step function:
$x[n] = u[n] = \begin{cases} 1 & \text{for } n \geq 0 \\ 0 & \text{elsewhere}\end{cases}$
$y[n] = x[n] \ast h[n]$
Calculate the output of this system for the given input.







Given the cascade of 2 LTI systems in series, with the following individual impulse responses:
$h_1 [n] = \delta[n] + 2\delta[n-1]$
$h_2 [n] = \delta[n] - \delta[n-1]$
Whta is the total impulse response $h[n]$ of the LTI system?







Consider an LTI system where the output $y[n]$ has been recorded from two different inputs $x[n]$ as shown below: $x_1[n] = \delta[n] + \delta[n-1] \quad \rightarrow \quad y_1[n] = \delta[n] + \delta[n-1] - \delta[n-2] - \delta[n-3]$
$x_2[n] = \delta[n] - \delta[n-1] \quad \rightarrow \quad y_2[n] = \delta[n] - \delta[n-1] - \delta[n-2] + \delta[n-3]$
What is the impulse response $h[n]$ of this LTI system?











Given the following FIR filter from which the initial state is equal to zero, thus $y[n] = 0$ for $n<0$.
FIR filter, question 5.
What is the value of $y[3]$?










Exercise bundle

This browser does not support PDFs. Please download the PDF to view it: Download PDF.

Answers

Download the answers here.

Pencast videos [⯈]

_The above video player contains a playlist of all pencast videos which can be expanded by clicking the playlist icon in the upper-right corner._



MATLAB lab

Accompanied to this modules are some exercises in MATLAB, which will test your knowledge of the module and will help improve your MATLAB skills.

Lab assignment

This browser does not support PDFs. Please download the PDF to view it: Download PDF.

MATLAB demo [⯈]



Summary

$$ \boxed{\text{Unit delta pulse: }\qquad \delta[n] = \begin{cases} 1 & n=0 \newline 0 & \text{elsewhere} \end{cases}} $$


$$ \boxed{\text{Unit step function: }\qquad u[n] = \begin{cases} 1 & n \geq 0 \newline 0 & \text{elsewhere} \end{cases}} $$


Realization scheme of a finite impulse response filter.
Realization scheme of a finite impulse response filter.

$$ \boxed{\text{Difference Equation FIR: } \qquad y[n] = \sum_{k=0}^{M-1} b_k x[n-k] } $$


$$ \boxed{\text{Impulse response FIR: } \qquad h[n] = \sum_{k=0}^{M-1} b_k \delta[n-k]} $$


A causal system has an impulse response for which $h[n]=0$ for $n<0$.

$$ \boxed{\text{Convolution sum FIR: }\qquad y[n] = \sum_{k=0}^{M-1} h[k] x[n-k]= \sum_{k=n-(M-1)}^{n} x[k] h[n-k] } $$


Convolution sum procedure:
  1. Plot the impulse response weights $h[k]$ as a function of index $k$.
  2. Plot the input signal samples $x[k]$ also as a function of index $k$.
  3. Mirror (reverse) the input signal samples. That is replace $x[k]$ into $x[-k]$.
  4. For each new index $n$, shift the mirrored signal samples $x[-k]$ to index $n$, resulting in $x[n-k]$.
  5. For each new index $n$, the output signal sample $y[n]$ is equal to the sum of the element by element multiplication of the sequence $h[k]$ and the sequence $x[n-k]$ in the range $k=0,1, \cdots , M-1$, since $h[k]=0$ outside this range of indices.

When the length of an input sequence of signal samples is $N$ and the length of the sequence of impulse response values is $M$, then the convolution sum procedure results in a sequence of length $N+M-1$ output signal samples $y[n]$.

$$ \boxed{\text{Linearity: }\qquad x[n]= \alpha x_1[n] + \beta x_2[n] \mapsto y[n]= \alpha y_1[n] + \beta y_2[n]} $$


$$ \boxed{\text{Time Invariance: }\qquad x[n] \mapsto y[n] \hspace{3mm} \Rightarrow \hspace{3mm} x[n-n_0] \mapsto y[n-n_0]} $$


$$ \boxed{ y[n]=h[n] \star x[n] = x[n] \star h[n]} $$


The cascading of two LTI systems, one with impulse response $h_1[n]$ and the other one with impulse response $h_2[n]$, can be combined to one LTI system with impulse response $h[n]=h_1[n] \star h_2[n]$.

The order of two LTI systems, one with impulse response $h_1[n]$ and the other one with $h_2[n]$, can be interchanged.