You are on page 1of 23

Digital Signal Processing ECR 305_L9

Lecture – 9 Objectives

Digital To learn and understand


Filter Structure  the FIR and IIR filter structure in
order to design these filters.
IUB Dr. Abdur Razzak 1
Digital filter ECR 305_L9

What is filter?

Filter is a generic name that means a linear time-invariant system


designed for a specific job of frequency selection or frequency
discrimination.

Hence discrete-time LTI systems are also called digital filters.

Type of digital filters:

There are two types of digital filters.


 FIR (Finite-duration Impulse Response)
 IIR (Infinite-duration Impulse Response)
IUB Dr. Abdur Razzak 2
FIR filter ECR 305_L9

If the unit impulse response of an LTI system is of finite duration,


then the system is called a finite-duration impulse response (or
FIR) filter. Hence for an FIR filter h(n) = 0 for n < n1 and for n >
n2. The following part of difference equation describes a causal
FIR filter:


M

yn   bm xn  m 
m 0

Furthermore, h(0) = b0, h(1) = b1,... , h(M) = bM, while all other
h(n)'s are 0.

FIR filters are also called non-recursive or moving average (MA)


filters.
IUB Dr. Abdur Razzak 3
IIR filter ECR 305_L9

If the impulse response of an LTI system is of infinite duration,


then the system is called an infinite-duration impulse response
(IIR) filter.

The following part of the difference equation describes a


recursive filter in which the output y(n) is recursively computed
from its previously computed values and is called an
autoregressive (AR) filter.


N

ak yn  k   xn 
k 0

The impulse response of such filter is of infinite duration and


hence it represents an IIR filter.
IUB Dr. Abdur Razzak 4
IIR filter (contd..) ECR 305_L9

The following general equation also describes an IIR filter.

N M

 a yn  k   b xn  m
k 0
k
m 0
m

It has two parts: an autoregressive (AR) part (LHS of equation)


and an moving average (MA) part (RHS of equation). Such an
IIR filter is called an autoregressive moving average (ARMA)
filter.

In MATLAB, IIR filters are described by the difference equation


coefficients {bm} and {ak } and are implemented by the
filter(b,a,x) function.
IUB Dr. Abdur Razzak 5
Digital filter structure ECR 305_L9

In earlier lectures we studied the theory of discrete systems in


both the time and frequency domains.

We will now use this theory for the processing of digital signals.
To process signals, we have to design and implement systems
called filters (or spectrum analyzers in some contexts).

The filter design issue is influenced by such factors as the type of


the filter (i.e., IIR or FIR) or the form of its implementation
(structures).

Hence before we discuss the design issue, we first concern


ourselves with how these filters can be implemented in practice.
This is an important concern because different filter structures
dictate different design strategies.
IUB Dr. Abdur Razzak 6
Basic elements ECR 305_L9

Since our filters are LTI systems, we need the following three
elements to describe digital filter structures.
Adder: This element has two inputs and one output. Three or more signals is
implemented by successive two-input adders.
Multiplier (gain): This is a single-input, single-output element. Nothing is
indicated means multiplication by 1.
Delay element (shifter or memory): This element delays the signal passing
through it by one sample. It is implemented by using a shift register.

IUB Dr. Abdur Razzak 7


IIR filter structures ECR 305_L9

The system function of an IIR filter is given by

Y z   m
M
1 2 M
b z    
H z  
b b z b z ...... b z
 m 0
 a0  1
m 0 1 2 M
;
X z  1   ak z
N  k 1 
1  a1z  a2 z  ...... aN z
2 N
k 1

where bm and ak are the coefficients of the filter.

We have assumed without loss of generality that a0 = 1. The order


of such an IIR filter is called N if aN = 0.

The difference equation of an IIR filter is expressed as


M N
yn    bm xn  m   ak yn  k 
m 0 k 1

IUB Dr. Abdur Razzak 8


Direct form ECR 305_L9

As the name suggests, the difference equation is implemented by


using delays, multipliers, and adders.

Let M = N = 4. Then the difference equation is


y n   b0 xn   b1 xn  1  b2 xn  2  b3 xn  3  b4 xn  4 
 a1 y n  1  a2 y n  2  a3 y n  3  a4 y n  4

which can be
implemented
as shown in
figure.
Direct form-I
IUB Dr. Abdur Razzak 9
Direct form (contd..) ECR 305_L9

There are two separate delay lines in this structure, and hence it
requires eight delay elements.

We can reduce this delay element count or eliminate one delay


line by interchanging the order in which the two parts are
connected in the cascade, which leads to direct form II structure.

Direct form-II
IUB Dr. Abdur Razzak 10
FIR filter structures ECR 305_L9

A finite impulse response (FIR) filter has a system function of the


form
M 1
H z   
n 0
bn z  n  b0  b1 z 1  b2 z  2  ...... bM 1 z  M 1

Hence the impulse response h(n) is

b , 0  n  M 1
hn    n
 0, otherwise

And the difference equation representation is

yn   b0 xn   b1 xn  1            bM 1 xn  M  1

IUB Dr. Abdur Razzak 11


FIR filter structures (contd..) ECR 305_L9

The order of the filter is M–1, while the length of the filter (which
is equal to the number of coefficient) is M.

The FIR filter structure is always stable, and they are relatively
simple compared to IIR structures.

FIR filter can be designed to have a linear phase response, which


is desirable in some applications.

We will consider FIR filter of the following FOUR structures:


 Direct form
 Cascade form
 Linear-phase form
 Frequency sampling form
IUB Dr. Abdur Razzak 12
Direct form ECR 305_L9

The difference equation is implemented as a tapped delay line


since there are no feedback paths.

Let M = 5 (i.e., a 4th-order FIR filter): then

yn   b0 xn   b1 xn  1  b2 xn  2  b3 xn  3  b4 xn  4

The direct form structure is given in fig. Since the denominator is


equal to unity, there is only one direct form structure.

IUB Dr. Abdur Razzak 13


Example-1 ECR 305_L9

An FIR filter is given by the following system function:


H  z   1  2.88z 1  3.4048z 2 1.74z 3  0.4z 4
Determine the diff equation and draw the direct form structure.
Solution: The difference equation is given by
yn   xn   2.88 xn  1  3.4048 xn  2
 1.74 xn  3  0.4 xn  4
The direct form structure is shown below:

IUB Dr. Abdur Razzak 14


Example-2 ECR 305_L9

An FIR filter is given by the following system function:

H  z   1  16
1 4
z  z 8
16

Determine the diff equation and draw the direct form structure.

Solution: The difference equation is given by


yn  xn  16.0625 xn  4  xn  8
The direct form structure is shown below:

IUB Dr. Abdur Razzak 15


Example-3 ECR 305_L9

Determine a direct-form realization for the following linear-phase


filters: hn   1,2,3,4,3,2,1
Solution: 
H  z   1  2 z 1  3z 2  4 z 3  3z 4  2 z 5  z 6
Y ( z )  X ( z ) H ( z )  X ( z )[1  2 z 1  3z 2  4 z 3  3z 4  2 z 5  z 6 ]
y (n)  x(n)  2 x(n  1)  3x(n  2)  4 x(n  3)  3x(n  4)  2 x(n  5)  x(n  6)

IUB Dr. Abdur Razzak 16


Example-4 ECR 305_L9

Determine the system function and impulse response of the


system shown in figure below:

Solution:

IUB Dr. Abdur Razzak 17


Assignment-8 (due on next class) ECR305_L9

Problems : 9.4, 9.6, 9.7, 9.30

IUB Dr. Abdur Razzak 18


MATLAB implementation ECR 305_L9

MATLAB
Examples

IUB Dr. Abdur Razzak 19


MATLAB functions ECR 305_L9

In MATLAB FIR filters are represented either as impulse response


values {h(n)} or as difference equation coefficients {bm} and {a0 = 1}.

Therefore to implement FIR filters, we can use either the conv(x,h)


function (and its modification that we discussed) or the filter(b,1,x)
function.

There is a difference in the outputs of these two implementations that


should be noted.
 The output sequence from the conv(x,h) function has a longer length
than both the x(n) and h(n) sequences.
 On the other hand, the output sequence from the filter(b,1,x) function
has exactly the same length as the input x(n) sequence.

In practice (and especially for processing signals) the use of the filter
function is encouraged.
IUB Dr. Abdur Razzak 20
MATLAB functions (contd..) ECR 305_L9

The following general equation also describes an IIR filter.

N M

 a yn  k   b xn  m
k 0
k
m 0
m

It has two parts: an autoregressive (AR) part and an moving


average (MA) part. Such an IIR filter is called an autoregressive
moving average (ARMA) filter.

In MATLAB IIR filters are described by the difference equation


coefficients {bn} and {ak } and are implemented by the
filter(b,a,x) function.

IUB Dr. Abdur Razzak 21


References ECR 305_L9

1. Vinay K. Ingle, and John G. Proakis, Digital Signal


Processing using MATLAB, Thomson Learning
Bookware Companion Series, 2007. (pp. 186–230)

IUB Dr. Abdur Razzak 22


Next class.. ECR 305_L9

FIR Filter
Design
IUB Dr. Abdur Razzak 23

You might also like