You are on page 1of 81

CSE 447

Digital Signal Processing

Dr. Md. Sujan Ali


Associate Professor
Dept. of Computer Science and Engineering
Jatiya Kabi Kazi Nazrul Islam University
Trishal, Mymensingh, Bangladesh

September 26, 2021


CSE 447: Digital Signal Processing
Digital Filter

September 26, 2021


CSE 447: Digital Signal Processing
September 26, 2021
CSE 447: Digital Signal Processing
Filtering
o In signal processing, a filter is a device or process
that removes some unwanted components or
features from a signal.
o A digital filter is a system that performs
mathematical operations on a sampled, discrete-
time signal to reduce or enhance certain aspects of
that signal.
o A filter passes certain frequency components
without any distortion and blocks other frequency
components
September 26, 2021
CSE 447: Digital Signal Processing
What is an impulse?
• An impulse is any short duration signal.
• For digital signals, an impulse is a signal that is equal to 1
for n=0 and is equal to zero otherwise, so: Impulse(0) = 1;
Impulse(1) = Impulse(2) = ... = Impulse(n) = 0; for n~=0
1 n0
Unit Impulse Function   n   0 otherwise

September 26, 2021


CSE 447: Digital Signal Processing
What is an impulse response?

• In signal processing, an impulse response or IR is the


output of a system when we feed an impulse as the input
signal.

September 26, 2021


CSE 447: Digital Signal Processing
What do we get from an impulse
response of a system?
• When we say that we want to get the response of a system to
an input, it basically means that we want to see how the
system respond to every individual frequency element of the
input signal.
• Impulse response is meant to evaluate the response of the
system for all frequency elements with the same magnitude.
• So by having the impulse response of a system, we actually
have the overall behavior of that system, which is very
important.
• An impulse response of a person can be found by slap him
on the face forcefully and then watching his reaction.

September 26, 2021


CSE 447: Digital Signal Processing
Digital filters

Fig. Simplified block diagram of a real time digital filter

September 26, 2021


CSE 447: Digital Signal Processing
Type of digital filter: FIR and IIR

Digital filters are broadly divided into two classes:

 Infinite impulse response (IIR)


 Finite impulse response (FIR)

September 26, 2021


CSE 447: Digital Signal Processing
Infinite impulse response (IIR) filter
• The infinite impulse response is a type of digital filter that
is used in Digital Signal Processing applications.
• A filter’s job is to allow certain types of signals to pass and
block the rest.
• The infinite impulse response filter is unique because it
uses a feedback mechanism.
• It requires current as well as past output data.

September 26, 2021


CSE 447: Digital Signal Processing
Why is the impulse response “infinite?”

• The impulse response is “infinite” because there is


feedback in the filter; if you put in an impulse (a single “1”
sample followed by many “0” samples), an infinite number
of non-zero values will come out (theoretically.)

September 26, 2021


CSE 447: Digital Signal Processing
Infinite impulse response (IIR) filter
 The IIR filter defines how the output signal is related to
the input signal by the difference equation
1
y ( n)  (b0 x[ n]  b1 x[ n  1]  ...  bP x[ n  P ]
a0
 a1 y[ n  1]  a2 y[ n  2]  ...  aQ y[ n  Q ])
Where
P is the feedforward filter order  
bi are the feedforward filter coefficients  
Q is the feedback filter order  
aj are the feedback filter coefficients  
x[n] is the input signal  
y[n] is the output signal.
September 26, 2021
CSE 447: Digital Signal Processing
Infinite impulse response (IIR) filter
A more condensed form of the difference equation (?) is:
Q
1 P
y ( n)  ( bi x[ n  i ]   a j y[ n  j ])
a0 i  0 j 1

which, when rearranged, becomes


Q P

a
j 0
j y[ n  j ]   bi x[ n  i ]
i 0

To find the transfer function of the filter, we first take the


Z-transform of each side of the above equation, where we
use the time-shift property to obtain:
Q P

a
j 0
j z Y ( Z )   bi z i X ( z )
j

i 0

September 26, 2021


CSE 447: Digital Signal Processing
Infinite impulse response (IIR) filter
We define the transfer function to be:
P

Y (Z ) b Z i
i

H (Z )   i 0
Q
X (Z )
 j
a
j 0
Z j

Considering that in most IIR filter designs coefficient   a0


is 1, the IIR filter transfer function takes the more
traditional form:
P

i
b Z i

H (Z )  i 0
Q
1  a jZ  j
j 1

September 26, 2021


CSE 447: Digital Signal Processing
Difference equation
• In mathematics, a recurrence relation is an equation that
recursively defines a sequence or multidimensional array
of values.
• The term difference equation refers to a specific type of
recurrence relation.
• However, "difference equation" is frequently used to refer
to any recurrence relation.

September 26, 2021


CSE 447: Digital Signal Processing
Advantages of an IIR filter

• IIR filters are more versatile.


• They are computationally easier to implement.
• They are cheaper too.
• The infinite response of the IIR filter is a cool feature
when you are looking for amplification of signals. Not so
much when you wish to attenuate them, though.

September 26, 2021


CSE 447: Digital Signal Processing
Disadvantages of an IIR filter
• Practically realizable digital IIR filters do not have a linear
phase response. The linear phase is a property where the
phase response of a filter is a linear function of the frequency.
• IIR filters cannot implement integer math, which is an easy to
use mathematical representation because it’s cheap, fast, and
easy to implement.
• IIR filters have a higher chance of being unstable.
• Additionally, they also have a higher chance of being affected
by quantization operations like truncation and rounding. This
is due to the feedback mechanism that introduces poles in the
transfer function. On the contrary, FIR filter transfer
functions do not have poles.

September 26, 2021


CSE 447: Digital Signal Processing
Finite impulse response (FIR) filter
• A finite impulse response (FIR) filter is a filter whose
impulse response is of finite duration, because it settles to zero
in finite time.
• For a causal discrete-time FIR filter of order N, each value of
the output sequence is a weighted sum of the most recent input
values:

y (n)  b0 x[n]  b1 x[n  1]  ...  bN x[n  N ]


N
Where,   b x[n  i ]
i
i 0
x[n] is the input signal
y[n] is the output signal,
N is the filter order
bi is the value of the impulse response at the i'th instant
September 26, 2021
CSE 447: Digital Signal Processing
Finite impulse response (FIR) filter
 Advantages of FIR over IIR:
1. FIR filter have linear phase characteristics whereas IIR are
non linear.
2. IIR filter can become difficult to implement and distort
adjustment(because of feedback) can alter the poles and
zeroes, which make the filters unstable whereas FIR filters
remain stable (absence of feedback).
3. Because of feedback present in IIR, they are some what
difficult to control as compare to FIR.
4. IIR filters require more adders and multipliers as compare to
FIR, hence IIR are more costly.
5. FIR filter consume low power and IIR filter need more power
due to more coefficients in design.
September 26, 2021
CSE 447: Digital Signal Processing
Finite impulse response (FIR) filter
 Disadvantages of FIR over IIR:
1. IIR filters are having fast computation speed as compare to
FIR.
2. FIR filters require more memory as compare to IIR.
3. Delay is more in FIR than IIR filters.
4. FIR has lower sensitivity than IIR filters.

September 26, 2021


CSE 447: Digital Signal Processing
Digital filter structure

 What is a digital filter


 A filter is a system that is designed to remove some
component or modify some characteristic of a signal
 A digital filter is a discrete-time LTI system which can
process the discrete-time signal.
 There are various structures for the implementation of
digital filters
 The actual implementation of an LTI digital filter can be
either in software or hardware form, depending on
applications

September 26, 2021


CSE 447: Digital Signal Processing
Digital filter structure

 Basic elements of digital filter structures


 Adder has two inputs and one output.
 Multiplier (gain) has single-input, single-output.
 Delay element delays the signal passing through it by one
sample. It is implemented by using a shift register.

September 26, 2021


CSE 447: Digital Signal Processing
Digital filter structure
• The computational algorithm of an LTI digital filter can be
conveniently represented in block diagram form using the basic
building blocks shown below
1. Adder

2. Constant multiplier

3. Signal multiplier

4. Delay

5. Advance

September 26, 2021


CSE 447: Digital Signal Processing
Digital filter structure

x (n ) b0 y (n )
b0 1 2
x (n ) y (n )
z-1
z-1 a1
a1
5 3
z-1
a2 a2 z-1
4

y( n)  b0 x( n)  a1 y( n  1)  a2 y( n  2)
September 26, 2021
CSE 447: Digital Signal Processing
Digital filter structure
 Advantages of block diagram representation
o Easy to write down the computational algorithm by inspection
o Easy to analyze the block diagram to determine the explicit
relation between the output and input
o Easy to manipulate a block diagram to derive other
“equivalent” block diagrams yielding different computational
algorithms
o Easy to determine the hardware requirements
o Easier to develop block diagram representations from the
transfer function directly

September 26, 2021


CSE 447: Digital Signal Processing
Digital filter structure
The major factors that influence the choice of a specific
structure
 Computational complexity
refers to the number of arithmetic operations (multiplications,
divisions, and additions) required to compute an output value
y(n) for the system.
 Memory requirements
refers to the number of memory locations required to store the
system parameters, past inputs, past outputs, and any
intermediate computed values.
 Finite-word-length effects in the computations
refers to the quantization effects that are inherent in any digital
implementation of the system, either in hardware or in software.
September 26, 2021 CSE 447: Digital Signal Processing
IIR Filter Structures

The characteristics of the IIR filter


 IIR filters have Infinite-duration Impulse Responses
 The system function H(z) has poles in 0 | z | 
 An IIR filter is a recursive system
P

i
b Z i

H (Z )  i 0
Q
1  a jZ  j
j 1

Q
1 P
y (n)  ( bi x[n  i ]   a j y[n  j ])
a0 i  0 j 1
The order of such an IIR filter is called Q if aQ≠0
September 26, 2021 CSE 447: Digital Signal Processing
IIR Filter Structures

 IIR Systems are represented in four different ways

  1. Direct form structures form I and form II


2. Cascade form structure
3. Parallel form structure
4. Lattice and lattice-ladder structure.

September 26, 2021


CSE 447: Digital Signal Processing
IIR Filter Structures
1. Direct form structures
• IIR systems can be described by a generalized equations
as
P Q
y (n)   bi x[n  i]   a j y[n  j ]
i 0 j 1
Z transform is given as
P

i
b Z i

H (Z )  i 0
Q
1  a jZ  j
j 1

September 26, 2021


CSE 447: Digital Signal Processing
IIR Filter Structures
1. Direct form structures
• In this form the difference equation is implemented
directly as given.
• There are two parts to this filter, namely the moving
average part and the recursive part (or the numerator and
denominator parts).
• Overall IIR system can be realized as cascade of two
function H1(z) and H2(z).
P
Here, H 1( Z )   bi Z i

i 0
Q
and H 2( Z )  1   a j Z  j
j 1
CSE 447: Digital Signal Processing
IIR Filter Structures
P Q
Direct form I
y (n)   bi x[n  i ]   a j y[n  j ]

i 0 j 1

b0 y1 ( n) y 2 ( n)
x (n ) y (n )
z-1 b1 -a1 z-1
x ( n  1) y ( n  1)
z-1 b2 -a2 z-1
x ( n  2) y( n  2)
bM-1
x ( n  P  1) -aN-1
z-1 y ( n  Q  1)
bM
x(n  P) -aN z-1
y (n  Q)
Figure: Direct form I Structure of the IIR system
CSE 447: Digital Signal Processing
IIR Filter Structures
 Direct form I
Example:
Determine the Direct Form I structure of the IIR Filter
described by the following difference equation;
y(n) = 0.5y(n-1) –0.76y(n-2) + 0.63y(n-3) + x(n) + 0.875x(n-1)
Solution:
1.Compute the Transfer Function, H(z).
Y(z) = 0.5z-1Y(z) –0.76z-2Y(z) + 0.63z-3Y(z) + X(z) +
0.875z-1X(z)
H(z) = Y(z) / X(z) = (1 + 0.875z-1) / (1 -0.5z-1 + 0.76z-2
-0.63z-3)
2. Now, draw Direct Form I structure based on the Transfer
Function, H(z)
3. The Direct Form I IIR Filter Structure is shown below:
CSE 447: Digital Signal Processing
IIR Filter Structures
 Direct form I
Example:
Determine the Direct Form I structure of the IIR Filter
described by the following difference equation;
y(n) = 0.5y(n-1) –0.76y(n-2) + 0.63y(n-3) + x(n) + 0.875x(n-1)
Solution:

CSE 447: Digital Signal Processing


IIR Filter Structures

 Direct form II
b0
x (n ) y (n )
z-1 b1 a1 z-1

z-1 b a2 z-1
2

bP-1

z-1 b
P
aQ-1 z-1
Figure: Direct form II Structure of
the IIR system aQ
CSE 447: Digital Signal Processing
IIR Filter Structures
 Direct form II
Example:
Determine the Direct Form II (Canonic) structure of the IIR
Filter described by the following difference equation;
y(n) = 0.5y(n-1) –0.76y(n-2) + 0.63y(n-3) + x(n) + 0.875x(n-1)

Solution:
Draw the structure based on the transfer function obtain from
previous example.

CSE 447: Digital Signal Processing


IIR Filter Structures
2. Cascade form structures
In cascade form, stages are cascaded (connected) in series. The
output of one system is input to another. Thus total K number
of stages are cascaded. The total system function 'H' is given by
H  H1 ( Z ).H 2 ( Z )......... H K ( Z )
Y1 ( Z ) Y2 ( Z ) Y (Z )
H  . ...... K
X 1 (Z ) X 2 (Z ) X K (Z )
The overall transfer function is M
H (Z )   H k (Z )
k 1

Figure: Cascade form structure of the IIR system


CSE 447: Digital Signal Processing
IIR Filter Structures
2. Cascade form structures
Example:
Determine the Cascade Form structure of the IIR Filter described by
the following difference equation;
y(n) = -¼ y(n-1) + 3/8y(n-2) + x(n) + 2x(n-1)+ x(n-2)
Solution:
1.Obtain the transfer function as below;
Y(z) = -¼ z-1Y(z) + 3/8 z-2Y(z) + X(z) + 2z-1X(z)+ z-2 X(z)H(z)
Y(z) / X(z) = (1 + 2z-1 + z-2 ) / (1 + ¼ z-1 -3/8z-2 )
1.Factorizethe transfer function as below;
H(z) = [(1 + z-1)(1 + z-1) / [(1 -¾ z-1)(1 + ½ z-1)]
1.Split the transfer function to become;
H(z) = H1(z).H2(z) = [(1 + z-1) / (1 -¾ z-1)].[(1 + z-1) / (1 + ½ z-
1
)]
CSE 447: Digital Signal Processing
IIR Filter Structures
2. Cascade form structures
Solution:
4. Construct the Cascade structure based on the transfer function;
H(z) = H1(z).H2(z) = [(1 + z-1) / (1 -¾ z-1)].[(1 + z-1 ) / (1 + ½ z-1)]

CSE 447: Digital Signal Processing


IIR Filter Structures
3. Parallel form structures
o To produce Parallel form of the IIR filter structure, the
numerator and denominator of the factorized system will be
split into summation form such as;

H(z) = H1(z) + H2(z)

o Partial Fraction Expansion (PFE) method can be


employed to obtain the split of the transfer function.

o Then, the structure will be constructed from each transfer


function.

CSE 447: Digital Signal Processing


IIR Filter Structures
3. Parallel form structures
Example:
Determine the Parallel Form structure of the IIR Filter described
by the following difference equation;
y(n) = -¼ y(n-1) + 3/8y(n-2) + x(n) + 2x(n-1) + x(n-2)
Solution:
1.Obtain the transfer function as Y(z) = -¼ z-1Y(z) + 3/8 z-2Y(z) +
X(z) + 2z-1X(z)+ z-2X(z)
H(z) = Y(z) / X(z) = (1 + 2z-1 + z-2) / (1 + ¼ z-1-3/8z-2)
2. Factorize the transfer function as
H(z) = [(1 + z-1)(1 + z-1) / [(1 -¾ z-1)(1 + ½ z-1)]
3.Split the transfer function using PFE technique to obtain;
H(z) = H1(z) + H2(z) = 8/3 + [(2/30) / (1 -¾ z-1)] + [(18/5) /
(1 + ½ z-1)]
CSE 447: Digital Signal Processing
IIR Filter Structures
3. Parallel form structures
Solution:
4. Construct the structure according to the transfer function
below;
H(z) = H1(z) + H2(z) = 8/3 + [(2/30) / (1 -¾ z-1)] + [(8/5) / (1 +
½ z-1)

CSE 447: Digital Signal Processing


FIR Filter Structures

The LTI system can be modeled using :

1.A Difference/Differential equation, y(n) = x[n] + x[n-1] + ...


2.Impulse Response, h(n)
3.Transfer Function, H(z)

CSE 447: Digital Signal Processing


FIR Filter Structures
 FIR filter specification

Example of the difference equation that can describe the FIR


system;

y(n) = x(n) + x(n-2) –2x(n+1)

The system transfer function to describe the FIR system;

H(z) = ∑h(n)z-n

CSE 447: Digital Signal Processing


FIR Filter Structures
There are several different realization block diagram of FIR
system.
1.Direct form
The difference equation of direct form structure can be
described as below;

y[n] = h(0) + h(1)z-1 + h(2)z-2 + h(N-1)z-(N-1) + h(N)z-N

This structure realization uses separate delays (memory) for


both input and output signal samples and the signal flow is from
left to right(1 direction) as shown below

CSE 447: Digital Signal Processing


FIR Filter Structures
2. Cascade from
For the higher order of FIR filter, the FIR filter structure can be
realized by implementing cascade form for the lower order of the
filter as described by the polynomial equation below;
H(z) = Σh(n)z-n = ∏(b0(k) + b1(k)z-1 + b2(k)z-2
The structure realization for 2nd order system using cascade form
is shown below;
Hk[z] = bk(0)+ bk(1)z-1 +bk(2)z-2

CSE 447: Digital Signal Processing


FIR Filter Structures
Example 1:
The system of LTI is described by the following difference
equation:
y[n] = 0.9x[n] + x[n-1] + 0.5x[n-2] –2.5x[n-3] -0.2x[n-4]
Draw a Direct Form structure realization for the system described
by this difference equation.
Solution 1:
1. This is FIR system and thus, convert it to z-transform;
Y(z) = 0.9X(z) + z-1 X(z)+ 0.5z-2 X(z) –2.5z-3 X(z) –0.2z-4 X(z)
2. Obtain the Transfer function, H(z);
H(z) = Y(z) / X(z) = 0.9 + z-1 + 0.5z-2 -2.5z-3 –0.2z-4
since, H(z)= Σh[n]z-n ,thus, h(0) = 0.9, h(1) = 1, h(2) = 0.5, h(3) =
-2.5, h(4) = -0.2 CSE 447: Digital Signal Processing
FIR Filter Structures

Solution 1:
3. Construct direct form structure for the system as shown below;

CSE 447: Digital Signal Processing


FIR Filter Structures
Example 2:
The LTI system is described by the transfer function as shown
below;
H(z) = (1 + ½ z-1 -2z-2 )(1 + ¼ z-1 + z-2 )
Draw a Cascade structure realization for the system described by
this difference equation.
Solution 2:
1. The FIR of 2 Transfer function is cascade form;

2. Thus, the transfer functions are;


H1(z) =1 + ½ z-1 -2z-2 , H2(z) = (1 + ¼ z-1 + z-2 )

CSE 447: Digital Signal Processing


FIR Filter Structures
Solution 2:
3. Now, draw the structure of the system;

CSE 447: Digital Signal Processing


FIR Filter Structures
Example 3:
Provide the cascade realization of an FIR filter with transfer
function
H(z)=1+3z-1 +3z-2 +z-3
Solution 3:
The transfer function is factored as
H(z)=(1+2z-1 +z-2)(1+z-1 )
which can be realized as the cascade of two FIR filters,
y1[n]=x[n]+x[n−1]
y[n]=y1[n]+2y1[n−1]+y1[n−2]

which are realized as shown in Figure


CSE 447: Digital Signal Processing
FIR Filter Structures
Example 3:
Provide the cascade realization of an FIR filter with transfer
function
H(z)=1+3z-1 +3z-2 +z-3
Solution 3:

Figure : Cascade realization of FIR filter.


CSE 447: Digital Signal Processing
Design of digital filters

 Definition of filters
o Filter is required in the digital signal processing to filter
the raw input signals to the desired frequency and suppress
noise in signal processing.

o Filter consists of Finite Impulse Response (FIR) and


Infinite Impulse Response Filter (IIR).

o There are four type filter such as Low-pass, High-pass,


Band-pass and Band -stop filter.

September 26, 2021


CSE 447: Digital Signal Processing
Design of digital filters
 FIR filters
o It is a system where the output of the system only depend on
the input signals.
o The system only has zeros and no poles.

o The system has no feedback.

o The system always stable.


o Example of the difference equation that can describe the
system;
y(n) = x(n) + x(n-2) – 2x(n+1)

September 26, 2021


CSE 447: Digital Signal Processing
Design of digital filters
 FIR filters design steps
1. The process of filter design begins with filter specifications which
include the filter characteristics (Low-pass, high-pass, band-pass,
band-stop filter), Filter Type (FIR or IIR), passband frequency,
stopband frequency, transition width frequency, cut-off frequency,
sampling frequency, filter order (N), stopband attenuation and
passband ripple.
2. The second step is to calculate filter frequency Response, H(e jω)|.
3. The third step is to find the filter coefficient or filter impulse
response.
4. The last step is to implement filter coefficient and choose
appropriate filter structure for implementation.

September 26, 2021


CSE 447: Digital Signal Processing
Design of digital filters
 1. FIR filters specification
o Before designing the FIR Filter, the set of the specification
must be defined.
o In order to do that, need to determine the cut-off
frequency, ωc(2πfc) for the filter.

o The Frequency Response for the ideal Low-Pass Filter is:


Hd (ejω ) = e-jω , |ω| ≤ ωc
0 , ωc <|ω| ≤ π

September 26, 2021


CSE 447: Digital Signal Processing
Design of digital filters
 2. FIR filters frequency response
 Amplitude Parameters;
• δp = Passband Ripple, Rp = -20log[(1- δp )/(1+ δp )] in dB
• Peak ripple, αp = -20log[(1- δp )] in dB
• δs = Stopband Ripple/Attenuation,
• As = -20log[(δs / 1+ δp)] in dB
• Minimum stopband attenuation, αs = -20log[(δs )] in dB
 Frequency Parameters;
• Sampling frequency = Fs
• Passband frequency, ωp = 2πfp , Normalized Passband frequency = ωp /Fs
• Stop-band frequency, ωs = 2πfs , Normalized Passband frequency = ωs /Fs
• Transition width, Δω = ωs - ωp
• Cut-off frequency, ωc = (ωs + ωp ) / 2
September 26, 2021
CSE 447: Digital Signal Processing
Design of digital filters
 3. FIR Filter Coefficient (Impulse response)
 The Impulse Response of the Filter is defined as:
sin( n   )c where α = N/2 π(n - α)
hd (n) 
 (n   )
 The FIR Filter Specification is defined as below;
1 – δp <| H(ejω) | ≤ 1 + δp , 0 <|ω| ≤ ωp | H(ejω ) | ≤ δs
, ωs ≤ |ω| < π

September 26, 2021


CSE 447: Digital Signal Processing
Design of digital filters
 4. FIR Filter Design by Window Method
 The Filter is designed by windowing the impulse
response:

h(n) = hd(n)w(n)

 w(n) is a finite-length window that is equal to zero


outside the interval of 0 ≤ n ≤ N

September 26, 2021


CSE 447: Digital Signal Processing
Design of digital filters
 4. FIR Filter Design by Window Method
Basically, there are 4 type of window :
 Rectangular
w(n) = 1, 0 ≤ n ≤ N
0, elsewhere

 Hanning
w(n) = 0.5 -0.5cos(2πn/N), 0 ≤ n ≤ N

0, elsewhere
September 26, 2021
CSE 447: Digital Signal Processing
Design of digital filters
 4. FIR Filter Design by Window Method
 Hamming
w(n) = 0.54 – 0.46cos(2πn/N), 0 ≤ n ≤ N
0, elsewhere

 Blackman
w(n) = 0.42 - 0.5cos(2πn/N) + 0.08cos(4πn/N), 0 ≤ n ≤ N
0, elsewhere

September 26, 2021


CSE 447: Digital Signal Processing
Design of digital filters
 4. FIR Filter Design by Window Method

 The relationship between the length of window, N and


Filter Transition width is shown below:
N∆f = c
c is a parameter of the window.

September 26, 2021


CSE 447: Digital Signal Processing
Design of digital filters
 4. FIR Filter Design by Window Method
 The window parameter, c is shown below:
1. Rectangular
N∆f = 0.9 , αs = -21 dB
2. Hanning
N∆f = 3.1 , αs = -44 dB
3. Hamming
N∆f = 3.3 , αs = -53 dB
4. Blackman
N∆f = 5.5 , αs = -74 dB
September 26, 2021
CSE 447: Digital Signal Processing
FIR filter design example 1
 Design the FIR Filter to meet the following specification
by using window method.

0.99 ≤ |H(ejω)| ≤ 1.01, 0 < |ω| ≤ 0.19


|H(ejω)| ≤ 0.01, 0.21π ≤ |ω| ≤ π

 Solution:
1. From the spec given, δs = 0.01, thus αs = -40 dB.
2. From the window parameter, the stopband attenuation is
close to Hanning Window, thus it is preferable to use
Hanning Window for this design.
September 26, 2021
CSE 447: Digital Signal Processing
FIR filter design example 1
3. Now, calculate the Transition Band or Width, ∆f: From the
given spec, ∆ω = ωs – ωp = 0.02π,
Thus, ∆f = ∆ω / 2 = 0.01
4. By using Hanning Window,
N∆f = 3.1
Thus, N = 3.1 / ∆f = 3.1 / 0.01 = 310
5. Next, determine the Cut-Off Frequency, ωc
ωc = ωs + ωp / 2 = 0.21 π + 0.19 π = 0.40 π / 2 = 0.2 π
6. Calculate the delay, α
α = N/2 = 310 / 2 = 155
7. Finally, the Impulse Response of the FIR Filter that meet the
spec is: hd (n) = sin [0.2 π(n-155)]/(n-155)π
September 26, 2021
CSE 447: Digital Signal Processing
FIR Filter Design Example 2
 Design the Bandpass Filter to meet the following
specification:
passband frequency = 900-1100 Hz
passband ripple = < 0.87 dB
stopband attenuation > 30 dB
sampling frequency = 15 kHz
Transition frequency = 450 Hz
Use Optimal Method to find suitable Filter Coefficients.

September 26, 2021


CSE 447: Digital Signal Processing
FIR Filter Design Example 2
 Solution:
1. Normalized all the frequencies by dividing the
passband and stopband frequencies with sampling
frequency. 450 -> 450/15000 = 0.03 900 ->
900/15000 = 0.06 1100 -> 1100/15000 = 0.073 1550 - >
1550/15000 = 0.1033 7500 -> 7500/15000 = 0.5

2. Obtain the Passband Ripple & Stopband Attenuation,


δp = 0.10535, δs = 0.031623

September 26, 2021


CSE 447: Digital Signal Processing
FIR Filter Design Example 2
 Solution:
The value of N is determined by:

 20 log10 (  s p )  13
N 1
The suitable Filter length, N = 28 14.6f / Fs
The Filter Coefficient can be determined by:
 20 log (0.057719)  13
 1
hd (n) = sin [0.015π(n-14)]/(n-14)π, 0 ≤ n ≤ N-1
10
14.6(0.03)
 28

September 26, 2021


CSE 447: Digital Signal Processing
IIR Filter Design
 IIR filter
 It is a system where the output of the system not only depend on the input signals but the past values
of the output signals.
 The system only has both zeros and poles.
 The system has feedback.
 The stability of the system depends on its poles.
 Example of the difference equation that can describe the system;
y[n] = ½ y[n-1] + 2x[n] + x[n-1]

September 26, 2021


CSE 447: Digital Signal Processing
IIR Filter Design
 IIR filter design steps
1. The process of filter design begins with filter specifications which include the filter
characteristics (Low-pass, high-pass, band-pass, band-stop filter), filter type, passband
frequency, stopband frequency, transistion width frequency, sampling frequency and filter
length.
2. The second step is obtain filter response, H(ω).
3. Third step is to find the filter coefficient and acceptable filter.
4. The last step is to implement filter coefficient and choose appropriate filter structure for filter
implementation.

September 26, 2021


CSE 447: Digital Signal Processing
IIR Filter Design
 IIR Filter Type
There are 4 commons IIR filter design;
1. Butterworth (As the Filter Order, N increases, the transition band becomes narrower).
2a. Chebyshev Type I (ripple at pass-band)
2b. Chebyshev Type II (ripple at stop-band)
3. Elliptic (ripple at both pass-band & stop-band)
4. Bessel (linear-phase response over the pass-band and exhibit larger transition bandwidth)

September 26, 2021


CSE 447: Digital Signal Processing
IIR Filter Design
IIR Filter Specifications: Butterworth filter
 Amplitude Parameters;
• Passband ripple = δp
• Stopband ripple = δp
• Discrimination Factor,
d = sqrt[((1-δp)-2 -1)/ (δs -2 – 1)] or ϵ/sqrt(A2 – 1)

 Frequency Parameters;
• Sampling frequency = Fs
• Selectivity Factor, k = Ωp / Ωs
• The Filter Order, N is defined as: N ≥log d / log k

September 26, 2021


CSE 447: Digital Signal Processing
IIR Filter Design
 Butterworth IIR Low-pass filter : Example
 Design the Butterworth Low-pass Filter to meet the following specifications: fp = 6 kHz,
fs = 10 kHz, δp = δs = 0.1

Solution :
1. Calculate d and k,
d = sqrt[((1-δp)-2 -1)/ (δs -2 – 1)] = 0.0487 k = Ωp / Ωs = 0.6
2. Calculate Filter Order, N
N ≥log d / log k = log (0.0487)/log (0.6) = 5.9
Thus, N = 6

September 26, 2021


CSE 447: Digital Signal Processing
IIR Filter Design
 Butterworth IIR Low-pass filter : Example

Solution :
3. To determine the cut-off frequency, Ωc
fp[(1-δp)-2 – 1]-1/2N = 6770
fs[δs-2 – 1]-1/2N = 6819
6770 ≤ Ωc ≤ 6819
4. The pole position are: sk = Ωc ej[π/2+(2k+1)π/12], k = 0,1,…,5
5. The Transfer Function is :
Ha(s) = 1 / [s6 + 3.8637s5 + 7.4641s4 + 9.1416s3 + 7.4641s2 + 3.8637s + 1

September 26, 2021


CSE 447: Digital Signal Processing
IIR Filter Design
 Butterworth IIR Band-pass filter : Example (cont’d)
 Design the Butterworth IIR Band-pass Filter to meet the following Filter
specifications by using Bilinear Transformation method. fp1 = 200 Hz, fp2 =
300 Hz, fs1= 50 Hz, fs2= 450 Hz, Ap = 3 dB, As = 20 dB, Fs=1000 Hz
Solution :
1. Calculate δp and δs
δp = 1 – antilog (-3/20) = 0.2921
δs = antilog(-20/20) = 0.1
2. Calculate d and k,
d = sqrt[((1-δp)-2 -1)/ (δs -2 – 1)] = 0.1
k = Ωp2 / Ωs2 = 300 / 450 = 0.67

September 26, 2021


CSE 447: Digital Signal Processing
IIR Filter Design
 Butterworth IIR band-pass filter : Example
 Design the Butterworth IIR Band-pass Filter to meet the following Filter specifications
by using Bilinear Transformation method. fp1 = 200 Hz, fp2 = 300 Hz, fs1= 50 Hz,
fs2= 450 Hz, Ap = 3 dB, As = 20 dB, Fs=1000 Hz
Solution :
3. Calculate Filter Order, N
N ≥ log d/log k = log (0.1)/log (0.67) N = 6
4. The transfer function,
H(s) 0.2857 s^4 - 0.5714 s^2 + 0.2857
s^4 + 8.882e-16 s^3 + 0.02882 s^2 - 8.327e-17 s + 0.1717

September 26, 2021


CSE 447: Digital Signal Processing
IIR Filter Design
 IIR Filter Specifications: Chebyshev filter
 There are 2 types of Chebyshev Filters; Type 1 and Type 2.
• Type 1 Chebyshev Filter is all-pole with an equiripple passband and a
monotonically decreasing stopband.
• The magnitude of Frequency Response of type 1 Chebyshev Filter is:
|Ha(jΩ)|2 = 1 / [1 + ϵ2 TN 2(Ω/ΩP )]
N = Filter Order
ΩP = passband cut-off frequency
ϵ = parameter that controls passband ripple amplitude

September 26, 2021


CSE 447: Digital Signal Processing
IIR Filter Design
 IIR Filter Specifications: Chebyshev filter
• The discrimination and selectivity factor formula is same as
Butterworth IIR filter.
• The Filter Order, N is determined by :
N ≥ [cosh-1 (1/d) / cosh-1 (1/k)]
• The Transfer Function is determined by:
Ga(s) = Ha(s)Ha(-s) = 1 / [1 + ϵ2 TN(s/jΩP )]
ϵ = [(1-δP )-2 – 1]1/2

September 26, 2021


CSE 447: Digital Signal Processing
IIR Filter Design
 IIR Filter Specifications: Chebyshev filter
The parameter, ϵ which control the pass-band ripple can be defined as
ϵ2 = 1 /[(1 – δp)2] – 1
The parameter, β which is related to ϵ is defined as:
β = [(sqrt(1 + ϵ2 ) + 1) / ϵ]1/N , N is filter length/order
r1 = Ωp (β2 + 1)/2β and r2 = Ωp (β2 - 1)/2β
The angular position that can be determined by:
θk = π/2 + (2k + 1)π/2N, k = 0,1,2,…N-1
The coordinate of the poles will be:
xk = r2cos θk , yk = r1sin θk , k = 0,1,2,…N-1
Thus, the poles are: xk + jyk

September 26, 2021


CSE 447: Digital Signal Processing
IIR Filter Design
 Chebyshev IIR low-pass filter : Example
Design a Chebyshev Type 1 low-pass filter to meet the following spec: fp= 6
kHz, fs= 10 kHz, δp = δs = 0.1
Solution :
1. Calculate d and k, d = sqrt[((1-δp)-2 -1)/ (δs -2 – 1)] = 0.0487 k = Ωp / Ωs = 0.6
2. Calculate the Filter Order, N
N ≥ [cosh-1 (1/d) / cosh-1 (1/k)] ≥ 3.38 = 4
3. Calculate pass-band ripple controller, ϵ
ϵ = (1 /[(1 – δp)2] – 1)1/2 = 0.4843
4. The magnitude of the frequency response of the Chebyshev Type I low-pass
filter: |Ha(jΩ)|2 = 1 / [1 + ϵ2 TN 2(Ω/ΩP )] = 1 / [1 + (0.4843)2Ω/(12000π)] = 1 /
[1 + 6.22x10-6 Ω]

September 26, 2021


CSE 447: Digital Signal Processing
IIR Filter Design
 Elliptic IIR band-pass filter : Example
Design a Elliptic band-pass filter to meet the following spec:
Pass-band frequency, fp= 20.5 – 23.5 kHz
Stop-band frequency, fs = 0 – 19 kHz, 25 – 50 kHz
Pass-band ripple, δp ≤ 0.25 dB
Stop-band attenuation > 45 dB
Sampling frequency, Fs = 100 kHzf
Solution :
1. Calculate d and k,
d = sqrt[((1-δp)-2 -1)/ (δs -2 – 1)] = 0.0284
k = Ωp / Ωs = 20.5/25 = 0.82
q = 0.5 (1 – (1-k2)1/4 / (1 + (1-k2)1/4 = 0.0693
September 26, 2021
CSE 447: Digital Signal Processing
IIR Filter Design

 Elliptic IIR band-pass filter : Example

Solution :
2. Calculate the Filter Order, N
N ≥ log (16/d2) / log(1/q) ≥ 3.7 = 4
3. System transfer function is;
H(s)= 0.006128 s^8 - 0.008248 s^7 + 0.02362s^6 -
0.02211 s^5 + 0.03505 s^4 - 0.02211 s^3 +
0.02362 s^2 - 0.008248 s + 0.006128

September 26, 2021


CSE 447: Digital Signal Processing

You might also like