You are on page 1of 9

EE 322M : Signal processing

Department of Electronics and Electrical Engineerng


Indian Institute of Technology, Guwahati
Winter 2023

Topic 17 : FIR and IIR filters


Instruction and notes by : Manish

1 Distortionless trnasmission
The meaning of distortionless transmission through a system is that the output signal is an
exact replica of the input signal, except perhaps with two minor modifications:

1. there is an amplitude gain

2. a constant time delay has occurred

This means that, we can write the condition as

y(t) = Cx(t − t0 )

or in the frequency domain

Y (ω) = CX(ω)e−jωt0
Y (ω)
⇒ H(ω) = = Ce−jωt0
X(ω)

Thus, we have the following two conditions for distortionless transmission:

1. The magnitude of H(ω) must be a constant as |H(ω)| = C

2. The phase response arg[H(ω)] must be linear as |H(ω)| = −ωt0

Such a system is also known as linear-phase system.

1
2 Low pass filters
An ideal low-pass filter (LPF) is a system that allows the passing of signals with a frequency
lower than a selected cutoff frequency. This means, it transmits all the frequencies inside the
passband without any distortion and rejects all the high frequencies outside the passband. For
such a filter: (
e−jωt0 , if |ω| < ωc .
H(ω) =
0, —ω| < ωc .

A rectangular pulse in frequency domain is a sinc function in time domain. The impulse
response of LPF can be computed with inverse Fourier transfer formula as
!
ωc ωc
h(t) = sinc (t − t0 )
π π

We often define frequency response of any filter in terms of passband (where frequencies are
allowed to pass through); stopband (where frequencies are rejected); and transition band (the
small transitional band which separates passband and stopband).

2
3 Digital filters
A digital filter is usually implemented to perform filtering action on continuous time signals. A
schematic is shown below to explain its uses. In practice, when a digital filter is implemented,
the input data and internal calculations are quantized to a finite precision. In doing so, round-
off errors occur and its performance differs from an ideal theoretical derivation.

There are two classes of digital filters depending on the duration of impulse response:
• Finite duration impulse response (FIR) digital filters: We generally define the trans-
fer function of an FIR digital filter as a polynomial in z −1 , with the following properties:
– They are BIBO stable
– They have finite memory
– Of course, we want them to be causal as well otherwise they won’t be realizable
• Infinite duration impulse response (IIR) digital filters: The transfer function of an
IIR digital filter is generally written as a rational function in z −1 .
Based on the filter properties, we define FIR and IIR filter characteristics as:

3.1 Basic structures of FIR and IIR filters in z-domain


Let’s go back to the difference equation form for any system
N
X M
X
y[n] = al y[n − l] + bk x[n − k]
l=1 k=0

3
3.1.1 FIR filters
In the above equation, FIR filters are characterized only by the non-recursive term:
M
X
y[n] = bk x[n − k]
k=0

or we can say
M
X
h[n] = bk δ[n − k]
k=0

or its z -transform X
H(z) = h[n]z −n
n

which will lead to a form

H(z) = ... + h[0] + h[1]z −1 + h[2]z −2 + h[3]z −3 + ...

Hence, we can say that H(z) is a polynomial in z −1 .

Thus, we can say that FIR filters contain only zeros and no poles outside the
origin.

3.1.2 IIR filters


The IIR filters have a recursive difference equation as we discussed in the beginning:
N
X M
X
y[n] = al y[n − l] + bk x[n − k]
l=1 k=0

Clearly, just like the above discussion, we can observe that the z -transform of such a filter
would be a rational function with numerator and denominator polynomials in z −1 .
We can write the general transfer function for a recursive digital filter as

1 + a1 z −1 + a2 z −2 + ... + aM z −M
H(z) = c
1 + b1 z −1 + b2 z −2 + ... + bN z −N
Clearly, IIR filters can have both poles and zeros anywhere in z -plane.

3.2 Pole - zero analysis


A system with a feedback loop contains poles that could be either in the origin or outside the
origin.
A system without a feedback loop contains only zeros placed anywhere in the z-plane and an
equal number of poles all placed in the origin of the plane. The number of zeros dictates the
length of the corresponding impulse response.

Also recall from the z -transform topic that

• A system that is both stable and causal must have all its poles inside the unit circle in
the z-plane.

4
Let’s see an example.
Example: Consider a system
z
H(z) =
z − 0.9
The pole is located at z = 0.9. Thus, this is an IIR system.
We can also rewrite the above expression as

H(z) = 1 + 0.9z −1 + 0.81z −2 + 0.729z −3 + ...

As we can see, the IIR system can be approximated by an infinite number of zeros (or we can
say it can be approximated by an FIR system).
This approximation would look like:

The corresponding pole-zero plot is:

5
4 FIR digital filters
Let’s begin with a moving average example. Consider the following three-point averaging
system:
1
y[n] = (x[n] + x[n + 1] + x[n + 2]) with x[n] = 0 for n < −2; n > 5
3
This equation describes a class of discrete-time systems called FIR filters. However, the equa-
tion isn’t realizable in practice as present output depends on future inputs. A slightly different
averaging system is:
1
y[n] = (x[n] + x[n − 1] + x[n − 2]) with x[n] = 0 for n < −2; n > 5
3
which is now a causal system.
This reminds us that we can write any such systems in terms of difference equations:
N
X M
X
y[n] = al y[n − l] + bk x[n − k]
l=1 k=0

A recursive equation represents IIR filters. However, the non-recursive part of this equation is
an FIR filter:
XM
y[n] = bk x[n − k]
k=0

In practice, we want our FIR filters to be causal so that they can be realizable. The above
equation is a causal one. The 3-point moving average problem discussed above is an FIR filter.
Now, here the terms:
M = filter order = number of memory blocks required to implement the filter
M + 1 = filter length = total No. of samples
bk = filter coefficients = An FIR filter equation can be Completely defined with them.

Example: FIR filter application: Now let’s assume we have a noisy signal and we want to
see the effect of moving average filter on that noisy signal. Let the signal be:

x[n] = [1.02]n + cos[2πn/8 + π/4]; for 0 < n < 40

given that the term [1.02]n = signal and the term cos[2πn/8 + π/4] = noise as shown below.

6
Let’s apply a three-point moving average filter to this i.e. the new averaged output:
2
1X
y3 [n] = x[n − k] :
3 k=0

Let’s apply a 7-point moving average filter to this i.e. the new averaged output:
6
1X
y7 [n] = x[n − k] :
7 k=0

Notice that the output after 7-point averaging is much smoother than 3-point averaging
method and the noise level is also low.

Now, based on the above analysis we deduce the following:

The general form of an FIR filter is:


M
X
y[n] = bk x[n − k]
k=0

This means that, if the input given to this system is x[n] then it’s impulse response h[n]
must have been ( y[n] = x[n] ∗ h[n]):
M
(
X bk n = [0, 1, 2, ...M ]
h[n] = bk δ[n − k] =
k=0
0 otherwise

7
Example: Find the impulse response h[n] for 3-point moving average filter.
solution: (
M
X 1 1/3 n = [0, 1, 2]
h[n] = δ[n − k] =
k=0
3 0 otherwise

Example: Find the difference equation governing the input-output relation with FIR filter
coefficients {3, −1, 2, 1}.
solution:
XM
y[n] = bk x[n − k]
k=0

y[n] = 3x[n] − x[n − 1] + 2x[n − 2] + x[n − 3]

4.1 Frequency response of FIR filter


We derived that
M
X
h[n] = bk δ[n − k]
k=0
Thus, it’s DTFT
M
X
H(Ω) = bk δ[n − k]e−jΩn
k=0
M
X
H(Ω) = bk e−jΩk
k=0

Example: Determine the frequency response of a five point moving average FIR filter:
4
1X
y[n] = x[n − k]
5 k=0

solution: From the above discussion,


4
1 X −jΩk
H(Ω) = e
5 k=0
1
= [1 + e−jΩ + e−j2Ω + e−j3Ω + e−j4Ω ]
5" #
1 1 − e−j5Ω
=
5 1 − e−jΩ
1 sin(5Ω/2)
= (e−j2Ω )
5 sin(Ω/2)

8
Just like the above example, we can write a generalized expression for frequency response
of M + 1 length averaging FIR filter as

1 sin((M + 1)Ω/2)
H(Ω) = (e−jM Ω/2 )
M +1 sin(Ω/2)

Reference material
1. Textbook: Digital Signal Processing by Z. Hussain, A. Sadik, P. O’Shea
2. Topic notes are inspired from the course materials of UCSB’s Discrete-time signals course.
[Please report any typos in the notes by sending an email to the instructor.]

You might also like