1. Discrete-Time Signals and Systems. Summary

Download Report

Transcript 1. Discrete-Time Signals and Systems. Summary

Lecture 2: February 27, 2007
Topics:
1. Introduction to Digital Filters
2. Linear Phase FIR Digital Filter.
Introduction
3. Linear-Phase FIR Digital Filter Design:
Window (Windowing) Method
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
Filter: system performing filtering
Analogue filtering: filtering performed on continuoustime signals and yields continuous-time signals
Digital/discrete-time filtering: filtering performed on
digital/discrete-time signals and yields digital/
discrete-time signals
6
Examples of filtering applications
A. Noise suppression
•
•
•
Received radio signals.
Signals received by imaging sensors, such as
television cameras or infrared imaging devices.
Electrical signals measured from the human body
(such as brain, heart or neurological signals).
7
B. Enhancement of selected frequency range
• Treble and bass control or graphic equalizers in
audio systems.
• Enhancement of edges in image processing.
C. Bandwith limiting
• Bandwidth limiting as a means of aliasing
prevention in sampling.
• Application in FDMA communication systems
(Frequency Division Multiple Access - FDMA).
8
D. Removal or attenuation of specific frequencies
• Blocking of the DC component of a signal.
• Attenuation of interference from powerline (50 Hz).
9
E. Special operations
Differentiation:
dx(t )
y (t ) 
dt
Y ( j )  j X ( j )
Integration:
t
y(t )   x( ) d

1
Y ( j ) 
X ( j )   X (0) ( )
j
Hilbert transform:
1
h (t ) 
t
H ( j )   j sgn( )
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.
Ideal magnitude frequency response
H  e j  1
0
0


11
2.2. Filter Specifications
2.2.1. Ideal Filters
Low-Pass Filters:
H e
j

1

0
for   0, 0  i.e.   pass  band
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.
Ideal magnitude frequency response
H  e j  1
0
0


13
High-Pass Filters:
H e
j

0

1
for   0,0 ) i.e.   stop  band
for   0 ,  i.e.   pass  band
Ideal magnitude frequency response
H  e 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.
Ideal magnitude frequency response
H  e j  1
0
1
2


15
Band-Pass Filters:
H e
j

0

1
for   0,1 )  (2 , ) i.e.   stop  band
for   1 ,2 
i.e.   pass  band
Ideal magnitude frequency response
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.
Ideal magnitude frequency response
H  e j  1
0
1
2


17
Band-Stop Filters:
H e
j

1

0
for   0, 1   2 , ) i.e.   pass  band
for   (1,2 )
i.e.   stop  band
Ideal magnitude frequency response
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:
Possible ideal magnitude frequency response
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
each stop
band.
ideal magnitude
frequency
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
B. Comments on group delay function: Group delay
function of ideal filters is constant:
d ( )
d
 ( )  

 t0   t0  const.
d
d
C. Note: It will be proved for linear phase FIR filters:
M 1
t0 
2
21
All-Pass Filters: A filter is called all-pass if its magnitude
response is identically a positive constant ( H (e j )  const).
at all frequencies. The phase response of an all-pass filter
is not restricted and is allowed to vary arbitrarily as a
function of the frequency.
In general, a rational filter is all-pass if only if it has the
same number of poles and zeros (including multiplicities),
and each zero is the conjugate inverse of a corresponding
pole: zk=1/pk.
Example:
0.8  z 1
H ( z) 
1  0.8 z 1
z1  1/ 0.8
p1  0.8
z1  1/ 0.8  1/ p1
22
Differentiator: The ideal frequency response of a digital
differentiator is
j
H e  
T
j
    
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
• pass band (bands),
• stop band (bands),
• transition band (bands),
• pass band cut off frequency/frequencies,
• stop band cut off frequency/frequencies,
•
•
pass band ripple/ripples,
stop band ripple/attenuation (ripples/attenuations).
25
H  e j 
stop bands
pass band
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
Mathematical model of a causal FIR digital filter:
M 1
y ( n)   h( k ) x ( n  k )
k 0
Digital FIR filters cannot be derived from analogue
filters, since causal analogue filters cannot have a finite
impulse response. In many digital signal processing
applications, FIR filters are preferred over their IIR 29
counterparts.
The advantages of FIR filters (1):
• FIR
filters with exactly linear phase can be easily
designed. This simplifies the approximation problem,
in many cases, when one is only interested in designing
of a filter that approximates an arbitrary magnitude
response. Linear phase filters are important for
applications where frequency dispersion due to
nonlinear phase is harmful (e.g. speech processing and
data transmission).
• There are computationally
efficient realizations for
implementing FIR filters. These include both nonrecursive and recursive realizations.
30
The advantages of FIR filters (2):
•
•
•
FIR filters realized non-recursively are inherently
stable and free of limit cycle oscillations when
implemented on a finite-word length digital system.
The output noise due to multiplication round off
errors in FIR filters is usually very low and the
sensitivity to variations in the filter coefficients is
also low.
Excellent design methods are available for various
kinds of FIR filters with arbitrary specifications.
31
The disadvantages of FIR filters:
• The relative computational complexity of FIR filter is
higher than that of IIR filters. This situation can be
met especially in applications demanding narrow
transition bands or if it is required to approximate sharp
cut off frequency. The cost of implementation of an FIR
filter can be reduced e.g. by using multiplier-efficient
realizations, fast convolution algorithms and multirate
filtering.
• The group delay function of linear phase FIR filters
need not always be an integer number of samples.
32
3.2. Frequency Response of Linear Phase FIR
Digital Filters
FIR filter of length M :
M 1
y ( n)   h( k ) x ( n  k )
k 0
M 1
H (e j )   h(k )e j k
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
B. Antisymmetrical impulse response:
h(k )  h( M  1  k ) for k  0,1,2,
, M 1
The length of the impulse response of the FIR filter
(M) can be even or odd. Then, the four cases of linear
phase FIR filters can be obtained.
34
3.2.1. Symmetrical Impulse Response, M: Even
h( n)
h(7)=h(8)
M  16
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
h(0)  h(3)
k  0,1,2,3
h(1)  h(2)
M
4
1  1  1
2
2
M 4
 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
k 0
k 0
k 0
H (e j )   h(k )e j k   h(k )e  j k   h(k )e  j k
H (e j )  h(0)e j 0  h(1)e j1  h(2)e j 2  h(3)e j 3 
 h(0)  e j 0  e j 3   h(1)  e j1  e j 2  
1
 j  4 1 k 
 j k


  h( k ) e
e


k 0
End.

M
1
2
 j k

h
(
k
)
e
e


k 0
 j  M 1 k 
 for M  4.

37
M 1
H (e )   h ( k )e
j
 j k
k 0
 2e
M
M 1 2 1
 j
2
j
H (e )  e
 j  M 1 k 
 j k


  h( k ) e
e


k 0
 h( k )
k 0
 j
M
1
2
M 1
2
e
 M 1 
j 
k 
 2

e
2
 M 1 
 j 
k 
 2

M
1
2
 M 1

2  h(k )cos  
k
 2

k 0
Here, the real-valued frequency response is given by
M
1
2
 M 1

H r ( )  2  h(k )cos  
k
 2

k 0
38
H (e j )  e
 j
M 1
2
H r ( )
M 1
 j

2
H
(

)
e

r

 M 1 
 j
 H ( ) e  2  
 r
H (e j )  H r ( )
for H r ( )  0
for H r ( )  0
d ( ) M  1
 ( )  

d
2
M 1

  2
 ( )  
 M  1  

2
for H r ( )  0
for H r ( )  0
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)
53 M 3
1

2
2
k  0,1,2,
M 1
2
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

 2 
 2 
42
M 1
H (e j )   h(k )e  jk 
k 0
M 1

j

M

1


2
 h
e


 2 
M 3
2
 j  M 1 k 
 j k


h( k ) e
e



k 0
 M 1 
 M 1 
M 3

j 
k 
 j 
k  
M 1
2
2




2
 j
M

1
e

e




2
e
h( k )

 h  2   2 

2
k 0


M 3


M 1
2
 j
M 1
 M 1

2  
e
h
 2  h(k )cos  
k

  2 
 2

k 0


the real-valued frequency response H r (43 )
H (e j )  e
 j
M 1
2
H r ( ) 
M 1
 j

2
H
(

)
e

r

 M 1 
 j
 H ( ) e  2  
 r
H (e j )  H r ( )
M 1

  2
 ( )  
 M  1  

2
for H r ( )  0
for H r ( )  0
d ( ) M  1
 ( )  

d
2
for H r ( )  0
for H r ( )  0
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
h(0)  h(3)
k  0,1,2,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
H (e j )   h(k )e  jk 
k 0
 2 je
M
M 1 2 1
 j
2
 h( k )
k 0
e
 j
M 1 
j
2
2
M
1
2
 j k

h
(
k
)
e
e


k 0
e
 M 1 
j 
k 
 2

e
2j
 j  M 1 k 
 M 1 
 j 
k 
 2




M
1
2
 M 1

2  h(k )sin  
k
 2

k 0
the real-valued frequency response H r ( )
47
H (e j )  e
 j
M 1 
j
2
2
H r ( ) 
M 1 
 j
j

2
2
 H r ( ) e

M 1 3
 j
j
 H ( ) e
2
2
 r
j
H (e )  H r ( )
for H r ( )  0
for H r ( )  0
d ( ) M  1
 ( )  

d
2
M 1 

  2  2
 ( )  
 M  1  3

2
2
for H r ( )  0
for H r ( )  0
48
Here, the real-valued frequency response is given by
M
1
2
 M 1

H r ( )  2  h(k )sin  
k
 2

k 0
M
1
2
 M 1

H r (0)  2  h(k )sin 0 
k0
 2

k 0
!
!
Low-pass and band-stop filters cannot possess an
antisymetrical impulse response because H r (0)  0.
49
3.2.4. Antisymmetrical Impulse Response, M: Odd
h( n)
M  17
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 !
53 M 3
1

2
2
k  0,1,2,
5 1 M 1
2

2
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 1
H (e )   h ( k )e
j
 j k
k 0
 2 je
 j  M 1 k 
 j k


  h( k ) e
e


k 0
M 3
M 1 2
 j
2
 h( k )
k 0
e
 j
M 1 

2
2
M 3
2
e
 M 1 
j 
k 
 2

e
2j
 M 1 
 j 
k 
 2


M 3
2
 M 1

2  h(k )sin  
k
 2

k 0
the real-valued frequency response H r ( )
52
j
H (e )  e
 j
M 1 
j
2
2
H r ( ) 
M 1 
 j
j

2
2
H
(

)
e
 r

M 1 3
 j
j
 H ( ) e
2
2
 r
H (e j )  H r ( )
for H r ( )  0
for H r ( )  0
d ( ) M  1
 ( )  

d
2
M 1 

  2  2
 ( )  
 M  1  3

2
2
for H r ( )  0
for H r ( )  0
53
Here, the real-valued frequency response is given by
M 3
2
 M 1

H r ( )  2  h(k )sin  
k
 2

k 0
M
1
2
 M 1

H r (0)  2  h(k )sin 0 
k0
 2

k 0
!
!
Low-pass and band-stop filters cannot possess an
antisymetrical impulse response because H r (0)  0.
54
4. Linear-Phase FIR Digital Filter
Design
4.1. Window (Windowing) Method
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
j
H (e ) 

 h ( k )e
k 
 j k
1
h( n) 
2


H (e j  )e j  n d 

The coefficients h( k ) of the Fourier series are easily
recognized as being identical to the impulse response of a
digital filter. There are two difficulties with the
application of the above given expressions for designing
of FIR digital filters:
56
1. The filter impulse response is infinite in duration,
since the above given summation extends to  .

j
 j k
H
(
e
)

h
(
k
)
e
2. The filter is unrealizable
(non-causal) because the


 ; i.e. no finite amount
impulse response beginsk at
of delay can make the impulse response realizable.

H (e j )   h(k )e  jk

Hence the filter resultingk from
a Fourier series
j
H
(
e
) is an unrealizable (nonrepresentation of
causal) IIR filter. In spite of that fact, the causal FIR
filter can be designed by the approach illustrated in the
next figures.
57
4.1.1. Summary
Non-Causal IIR filter:
y ( n) 


H (e j ) 
h( k ) x ( n  k )
k 
1
h( n) 
2



 j k
h
(
k
)
e

k 
H (e j  )e j  n d 

Causal filter :
h(k )  0 for k  0
FIR filter :
 M  N : h(n)  0 for n  M
Causal FIR filter of length M:
M 1
y ( n)   h( k ) x ( n  k )
k 0
M 1
H (e )   h ( k )e
j
k 0
 j k
58
Window (Windowing) Method: Time-Domain
( nR) for  N  n  N ;
n  (, )
w(n)h
w(n)  0 for n  N

w(n)
1
Rectangular
j window
j n
h( n) 
H (e )e d 

2  N  3
n
M 7
red
n
f ( n)
f (n)  h(n) w(n)
red
n
g (n)
g (n)  f (n  3)
n
59
Windows (Windowing) Method: Frequency-Domain
j
H
e

H e 

No ripple!
 
j
j
H  e j   FT [h(n)]
W  e j 
f (n)  h(n) w(n)

W  e j   FT [w(n)]
Side lobes
Ripple!
Central
(main) lobe
F e
j


F  e j   H  e j  *W  e j 
Gibbs Phenomenon
60
Example:
By the impulse response truncation method (by the
windowing method at rectangular window application)
design a low-pass filter of order N=15 with pass-band cut
off frequency (pass-band edge frequency) f 0  1kHz .
Frequency sampling is f S  4 kHz.
Solution:
f S  4 kHz f 0  1kHz
2
2

3
0 
fo 
.1.10 
3
fs
4.10
2


1 for   0 


2
j
Low-pass filter: H (e )  
0 for   0  

2
61

1
1
j
j n
h( n) 
H (e )e d  

2
2 
 /2
jn
1 e 

2  jn   / 2
1 e

n
jn

2
 /2

1e jn d 
 /2

 jn
 jn 2
1 e
e 2


n  2 j
2j

e
2j
 jn

2




 
sin  n 
2


n
62
Problem:
 
sin  n 
0
2

h( n) 
for n  0 
n
0
?
Solution (1):
1
h(0) 
2
1

2


H (e j  )e j  0 d  

 /2
1
 /2
1 d 
  / 2 

2
 / 2
1

2
    
 2    2    0.5



63
Solution (2):
 
sin  n 
2
h(0)  lim h(n)  lim 

n 0
n 0
n
 
 
sin  n 
sin  n 
21 1
2 1


 lim
 lim
  0.5
n 0
n 0


2
2
2
n
n
2
2
Rectangular window application:
f ( n)  h( n)
for n  7,7 
64
Example: Impulse Responses
h( n)  f ( n)
n  7,7 
n
n  0,14 
g (n)
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
Direct truncation of impulse response leads to well
known Gibbs phenomenon. It manifests itself as a
fixed percentage overshoot and ripple before and
after discontinuity in the frequency response. E.g.
standard filters, the largest ripple in the frequency
response is about 9% of the size of discontinuity and
its amplitude does not decrease with increasing
impulse response duration – i.e. including more and
more terms in the Fourier series does not decrease the
amplitude of the largest ripple. Instead, the overshoot
is confined to a smaller and smaller frequency range as
is increased.
67
Example: Gibbs phenomenon illustration
Next figures: Magnitude responses of the N-th order
FIR low-pass digital filters with normalized cut off
frequency  / 2 , for N=5, 25, 50, 100. The figures
confirm the above given statements concerning the
Gibbs phenomenon.
68
Low-Pass FIR Filter: Rectangular Window Application
N 5
N  25
G  e j 
G  e j 
 /2
G e
j

 /2

N  50

 /2
G  e j 
 /2

N  100
 69
Comments:
The major effect is that discontinuities of H (e j )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 )
it is clear that the width of these transition bands depends
j
on the width of the main (central) lobe of W (e ) .
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
Rectangular: w(n)  1
w(n)  0 for n  N
n
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
 0.08cos 72
Blackmann: w(n)  0.42  0.5cos
2N  1
2N  1
Kaiser (adjustable window): parameter 
2 

n

I0  1    

N 


w( n)  
I 0 ( )
  x / 2
I 0 ( x)  1   
 r!
r 1


r




2
I 0 ( x) : the modified zero-th-order Bessel function of the
first kind, which has the simple power series
expansion.
For most practical applications, about 20 terms
in the above summation are sufficient to arrive at
reasonably accurate
73
Window Function: A Review (M=55, N=27)
w(n)
Bartlett w(n)
Hann
n
w(n)
Hamming
n
n
w(n)
Blackman
n
74
w(n)
 =15
=30
Kaiser Window
=1  =3
 =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.
Solution: MATLAB function fir1.m. For the results see
the next figures.
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
Kaiser Window: alfa=3
Kaiser Window: alfa=10
Kaiser Window: alfa=15
Kaiser Window: alfa=30
78