DF Lesson 02
DF Lesson 02
Topics:
1. Introduction to Digital Filters
1
Lecture 2: February 27, 2007
Topic:
1. Introduction to Digital Filters
• basic terminology and definitions: filtering, filter, analogue
filtering, digital/discrete-time filtering and filters,
• frequency-selective filter classification,
• basic parameter specification for filter design.
2
Lecture 2: February 27, 2007
Topic:
2. Linear Phase FIR Digital Filter.
Introduction
• advantages and disadvantages of linear phase FIR digital
filters,
• linear phase conditions for FIR filters,
• four groups/kinds of linear phase FIR digital filters.
3
Lecture 2: February 27, 2007
Topic:
3. Linear-Phase FIR Digital Filter Design:
Window (Windowing) Method
• basic principles and algorithms,
• method description in time- and frequency-domain,
• Example A.: FIR filter design-rectangular window application,
• Gibbs’ phenomenon and different windowing applications,
• Example B.: FIR filter design at different window
applications.
4
2. Introduction to Digital Filters
2.1. Definitions of Basic Terms
5
Filtering: process of extraction of desired signal from
noise
A. Noise suppression
7
B. Enhancement of selected frequency range
9
E. Special operations
Differentiation:
dx(t )
y (t ) Y ( j ) j X ( j )
dt
Integration:
t
y (t ) x( ) d
1
Y ( j ) X ( j ) X (0) ( )
j
Hilbert transform:
1
h(t ) H ( j ) j sgn( )
t 10
2.2. Filter Specifications
2.2.1. Ideal Filters
Low-Pass Filters: Low-pass filters are designed to pass
low frequencies, from zero to a certain cut off frequency
and to block high frequencies.
H e j 1
0
0 11
2.2. Filter Specifications
2.2.1. Ideal Filters
Low-Pass Filters:
1 for 0, 0 i.e. pass band
He j
0 for (0 , i.e. stop band
Ideal magnitude frequency response
H e j 1
0
0 12
High-Pass Filters: High-pass filters are designed to
pass high frequencies, from a certain cut off frequency
to , and to block low frequencies.
He j
1
0
0
13
High-Pass Filters:
He j
1
0
0
14
Band-Pass Filters: Band-pass filters are designed to
pass a certain frequency range, which does not
include zero, and to block other frequencies.
H e j 1
0
1 2
15
Band-Pass Filters:
H e j 1
0
1 2
16
Band-Stop Filters: Band-stop filters are designed to
block a certain frequency range, which does not include
zero, and to pass other frequencies.
H e j 1
0
1 2
17
Band-Stop Filters:
H e j 1
0
1 2
18
Multiband Filters: This type of filters generalizes the
previous four types of filters in that it allows for different
gains or attenuations in different frequency bands. A
piecewise –constant multiband filter is characterized by
the following parameters:
H e j 1
0
1 2 3 4 5 6 19
• A division of the frequency range to a finite union of
intervals. Some of these intervals are pass bands, some
are stop bands, and the remaining can be transition
bands.
• A desired gain and a permitted tolerance for each pass
band.
•Possible
An attenuation threshold for
ideal magnitude each stop
frequency band.
response
H e j 1
0
1 2 3 4 5 6 20
A. Comments on phase response: The phase response
of ideal filters is linear:
( ) t0
d ( ) d
( ) t0 t0 const.
d d
0.8 z 1
Example: H ( z) z1 1/ 0.8 p1 0.8
1 0.8 z 1
z1 1/ 0.8 1/ p1 22
Differentiator: The ideal frequency response of a digital
differentiator is
j
He j
T
Ideal normalized frequency response
H e j j
0
23
Hilbert Transformer: The frequency response of an
ideal Hilbert transformer is
j 0
j
H (e ) 0 0
j 0
Ideal normalized frequency response
H e j j
1
0
1
24
2.2.2. Practical (Real, Causal) Filters:
Description by a Set of Parameters
transition
bands
s ,1 p ,1 p ,2 s ,2 26
H e j 1 p p : pass-band ripple
s :
stop-band ripple
1 p (attenuation)
s
s ,1 p ,1 p ,2 s ,2 27
3. Linear Phase FIR Digital Filter.
Introduction
3.1. Advantages and Disadvantages
of
Linear Phase FIR Digital Filters
28
FIR digital filter has a finite number of non-zero
coefficients of its impulse response:
M N : h(n) 0 for n M
31
The disadvantages of FIR filters:
32
3.2. Frequency Response of Linear Phase FIR
Digital Filters
M 1 M 1
y ( n) h( k ) x ( n k ) H (e j ) h(k )e j k
k 0 k 0
33
It will be shown that the linear phase condition is
obtained by imposing symmetry conditions on the
impulse response of the filter. In particular, we consider
two different symmetry conditions for h(k):
A. Symmetrical impulse response:
h(k ) h( M 1 k ) for k 0,1,2, , M 1
h(2)=h(13)
h(1)=h(14)
h(0)=h(15)
n 35
Example: M=4 (even), symmetrical impulse response
M 1 4 1 3 k 0,1,2,3
h(0) h(3) h(1) h(2)
M 4 M 4
1 1 1 2
2 2 2 2
k 0,1,2, , M 1
h(0) h( M 1), h(1) h( M 2), h(2) h( M 3), ,
M M
h 1 h
2 2
36
M 1 4 1 3
H (e j ) h(k )e j k h(k )e j k h(k )e j k
k 0 k 0 k 0
h(0) e j 0 e j 3 h(1) e j 1 e j 2
1
h( k ) e
j 4 1 k
j k
e
k 0
M
1
2
End.
k 0
h ( k )
e j k
e
j M 1 k
for M 4.
37
M
1
M 1 2
H ( e ) h ( k )e h(k ) e
j M 1 k
j j k
j k
e
k 0 k 0
M M 1 M 1
j k j k
M 1 2 1
j e 2
e 2
2e 2
h( k )
k 0 2
M
M 1 1
j 2
M 1
j
H (e ) e 2
2 h(k )cos k
k 0 2
Here, the real-valued frequency response is given by
M
1
2
M 1
H r ( ) 2 h(k )cos k
k 0 2
38
M 1
j
H (e j ) e 2
H r ( )
j
M 1
H r ( ) e 2
for H r ( ) 0
M 1
H ( ) e 2
j
for H r ( ) 0
r
H (e j ) H r ( ) d ( ) M 1
( )
d 2
M 1
2 for H r ( ) 0
( )
M 1 for H r ( ) 0
2 39
We observe that the phase response is a linear function
of provided that H r ( ) is positive or negative.
When H r ( ) changes the sign from positive to negative
(or vice versa), the phase undergoes an abrupt change
of radians. If these phase changes occur outside the
pass-band of the filter we do not care, since the desired
signal passing through the filter has no frequency
content in the stop-band.
40
3.2.2. Symmetrical Impulse Response, M: Odd
h( n) M 15
“h(7)=h(7)”
h(6)=h(8)
h(1)=h(13)
h(0)=h(14)
n 41
Example: M=5 (odd), symmetrical impulse response
M 1 4 k 0,1,2,3,4
h(0) h(4) h(1) h(3) h(2) h(2)
53 M 3 M 1
1 2
2 2 2
k 0,1,2, , M 1
M 1
M 3 M 1
j k j k
M 1
j M 1 2
e 2
e 2
e h 2 2 h( k )
2
k 0 2
M 1 M 3
j
2
M 1 2
M 1
e h 2 h(k )cos k
2 k 0 2
the real-valued frequency response H r (43 )
M 1
j
H (e j ) e 2
H r ( )
j
M 1
H r ( ) e 2
for H r ( ) 0
M 1
H ( ) e 2
j
for H r ( ) 0
r
H (e j ) H r ( ) d ( ) M 1
( )
d 2
M 1
2 for H r ( ) 0
( )
M 1 for H r ( ) 0
2 44
3.2.3. Antisymmetrical Impulse Response, M: Even
h( n) M 16
h(1)=-h(14)
h(0)=-h(15)
h(7)=-h(8)
n 45
Example: M=4 (even), antisymmetrical impulse response
M 1 3 k 0,1,2,3
h(0) h(3) h(1) h(2)
4 M
1 1 1
2 2
k 0,1,2, , M 1
h(0) h( M 1), h(1) h( M 2), h(2) h( M 3), ,
M M
h 1 h
2 2
46
M
1
M 1 2
H (e j ) h(k )e jk j M 1 k
h ( k ) e j k
e
k 0 k 0
M M 1 M 1
j k j k
M 1 2 1
j e 2
e 2
2 je 2
h( k )
k 0 2j
M
M 1 1
j j 2
M 1
e 2 2
2 h(k )sin k
k 0 2
j
H (e ) H r ( ) d ( ) M 1
( )
d 2
M 1
2 2 for H r ( ) 0
( )
M 1 3 for H r ( ) 0
2 2 48
Here, the real-valued frequency response is given by
M
1
2
M 1
H r ( ) 2 h(k )sin k
k 0 2
!
1
2
M 1
H r (0) 2 h(k )sin 0 k0
k 0 2
h(1)=-h(15)
h(0)=-h(16)
h(8)=-h(8)=0 !
h(7)=-h(9)
n 50
Example: M=5 (odd), antisymmetrical impulse response
M 1 4, k 0,1,2,3,4
h(0) h(4), h(1) h(3), h(2) h(2) h(2) 0 !
53 M 3 5 1 M 1
1 2
2 2 2 2
k 0,1,2, , M 1
h(0) h( M 1), h(1) h( M 2), h(2) h( M 3), ,
M 3 M 1
h h ,
2 2
M 1 M 1
h h 0
2 2 51
M 3
M 1 2
H ( e ) h ( k )e h( k ) e
j M 1 k
j j k
j k
e
k 0 k 0
M 3 M 1 M 1
j k j k
M 1 2
j e 2
e 2
2 je 2
h( k )
k 0 2j
M 3
M 1
j 2
M 1
e 2 2
2 h(k )sin k
k 0 2
H (e j ) H r ( ) d ( ) M 1
( )
d 2
M 1
2 2 for H r ( ) 0
( )
M 1 3 for H r ( ) 0
2 2 53
Here, the real-valued frequency response is given by
M 3
2
M 1
H r ( ) 2 h( k )sin k
k 0 2
M
!
1
2
M 1
H r (0) 2 h(k )sin 0 k0
k 0 2
55
4.1.1. Basic Principles and Algorithms
j
Since H (e ) , the frequency response of any digital
filter is a periodic in frequency, it can be expended in a
Fourier series. The resultant series is of the form
1
j
H (e ) h( k )e
k
j k
h( n)
2
H ( e j )e j n d
k 0 k 0 58
Window (Windowing) Method: Time-Domain
n (, ) w(n)h
(nR) for N n N ;
w(n) 0 for n N n
w(n) 1
Rectangular j window
jn
h( n) H ( e ) e d
M 7 2 N 3 n
red f ( n)
f (n) h(n) w(n) n
red g (n)
g (n) f (n 3) n
59
Windows (Windowing) Method: Frequency-Domain
No ripple!
H
H e j
e j
j
H e j FT [h(n)]
W e j Central
(main) lobe
W e j FT [ w(n)]
Side lobes
Ripple! Fe j
Solution:
2 2
f S 4 kHzf 0 1kHz 0 fo 3
.1.10
3
fs 4.10 2
1 for 0
j 2
Low-pass filter: H (e )
0 for 0
2 61
/2
1 1
1e j n d
j jn
h( n ) H ( e )e d
2 2 / 2
/2 jn 2 jn
1 e jn
1 e e 2
2 jn / 2 n 2 j 2j
jn jn sin n
1 e 2
e 2
2
n 2j n
62
sin n
Problem: h( n)
n
2
for n 0
0
0 ?
Solution (1):
1
h(0)
2
H (e j )e j 0 d
/2
1 1
/ 2
/2
2
/ 2
1 d
2
1
2 2 0.5
2
63
Solution (2):
sin n
2
h(0) lim h( n) lim
n 0 n 0 n
sin n sin n
21 1 2 1
lim lim 0.5
n 0 2 2 n 0 2
n n
2 2
f ( n) h( n) for n 7,7
64
Example: Impulse Responses
h( n) f ( n) n 7,7
g ( n) n 0,14
g(0)=f(-7)
g(1)=f(-6) g(14)=f(7)
n 65
Example: Magnitude Response
G e j
0
2
Example: Phase Response
( )
0
2
66
4.1.2. Gibbs Phenomenon and Different Windowing
68
Low-Pass FIR Filter: Rectangular Window Application
N 5 G e j N 25
G e j
/2 /2
G e j
N 50 G e j N 100
/2 /2 69
Comments:
j
The major effect is that discontinuities of H (e )became
transition bands between values on the either side of the
discontinuity. Since the final frequency response of the
filter is the circular convolution of the ideal frequency
response with the window’s frequency response
F (e j ) H (e j ) * W (e j )
70
The second effect of the windowing is that the ripple
from the side lobes produces a ripple in the resulting
frequency response. Finally, since the filter frequency
response is obtained via convolution relation, it is clear
that the resulting filters are never optimal in any sense,
even though the windows from which they are obtained
may satisfy some reasonable optimality criterion:
a) Small width of the main lobe of the frequency
response of the window containing as much the total
energy as possible.
b) Side lobes of the frequency response that decrease in
energy rapidly as tends to .
71
4.1.2.1. Some Commonly Used Windows
M 1
N
2
w(n) R for N n N w(n) 0 for n N
n
Rectangular: w( n) 1 Bartlett: w(n) 1
N 1
1 2 n
Hann: w(n) 1 cos
2 2 N 1
2 n
Hamming: w(n) 0.54 0.46cos
2N 1
2 n 4 n
Blackmann: w(n) 0.42 0.5cos 0.08cos 72
2N 1 2N 1
Kaiser (adjustable window): parameter
n
2
I0 1 2
N x / 2 r
w(n) I 0 ( x) 1
I 0 ( ) r!
r 1
n n
n n 74
Kaiser Window
w(n) =15 =1 =3
=30 =8
n 75
Example:
By the windowing method, design a low-pass filter of
order N=55 with pass-band cut off frequency f 0 1kHz .
Frequency sampling is f S 4 kHz.
76
Example:FIR Filter Design by Windowing Method
20 * log10 H e j N=55
[dB]
Bartlett Window
Rectangular Window
Hamming Window
77
Example:FIR Filter Design by Windowing Method
20 * log10 H e j [dB] Rectangular Window
78