Chapter7 Filter Design Techniques

Report
Biomedical Signal processing
Chapter 7 Filter Design Techniques
Zhongguo Liu
Biomedical Engineering
School of Control Science and Engineering, Shandong
University
2015/4/13
1
Zhongguo Liu_Biomedical Engineering_Shandong Univ.
Chapter 7 Filter Design Techniques
7.0 Introduction
7.1 Design of Discrete-Time IIR Filters
From Continuous-Time Filters
7.2 Design of FIR Filters by Windowing
7.3 Examples of FIR Filters Design by the
Kaiser Window Method
7.4 Optimum Approximations of FIR Filters
7.5 Examples of FIR Equiripple
Approximation
7.6 Comments on IIR and FIR DiscreteTime Filters
2
Filter Design Techniques
7.0 Introduction
3
7.0 Introduction
Frequency-selective filters pass only
certain frequencies
Any discrete-time system that modifies
certain frequencies is called a filter.
We concetrate on design of causal
Frequency-selective filters
4
Stages of Filter Design
The specification of the desired
properties of the system.
The approximation of the specifications
using a causal discrete-time system.
The realization of the system.
Our focus is on second step
Specifications are typically given in the
frequency domain.
5
Frequency-Selective Filters
Ideal lowpass filter
 
H lp e
jw
1,
w  wc

 0, wc  w  
sin wc n
hlp n  
,   n  
n
H e 
jw
1
 2
6

 wc
0
wc

2
Frequency-Selective Filters
Ideal highpass filter
0,
w  wc
H hp  e   
 1, wc  w  
sin wc n
hhp  n     n 
,   n  
n
jw
 
H e jw
1
 2
7

 wc
0
wc

2
Frequency-Selective Filters
Ideal bandpass filter
 
H bp e
jw
1, wc1 w  wc2

0, others
 
H e jw
1

8
 wc2
 wc1
0
wc1
wc2

Frequency-Selective Filters
Ideal bandstop filter
 
H bs e
jw
0, wc1 w  wc2

1, others
 
H e jw
1

9
 wc2
 wc1
0
wc1
wc2

Linear time-invariant discrete-time system
If input is bandlimited and sampling frequency
is high enough to avoid aliasing, then overall
system behave as a continuous-time system:


 H e jT ,
H eff  j   
0,
  T
  T
continuous-time specifications are converted to discrete
time specifications by:
 w
jw
H e
 H eff  j  , w  
w  T
 T
10
 
Example 7.1 Determining Specifications
for a Discrete-Time Filter
Specifications of the continuous-time filter:
1. passband 1  0.01  H eff  j   1  0.01 for 0    2 2000 
2. stopband H eff  j   0.001 for 2 3000   
4


 H e jT ,
H eff  j   
0,
11
T  10 s
  T
  T
1 
2 f max  2

2T T
 2  5000 
Example 7.1 Determining Specifications
for a Discrete-Time Filter
Specifications of the continuous-time filter:
1. passband 1  0.01  H eff  j   1  0.01 for 0    2 2000 
2. stopband H eff  j   0.001 for 2 3000   
1  0.01
 2  0.001
 p  2 (2000)
s  2 (3000)
12
4
T  10 s
1 
2 f max  2

2T T
 2  5000 
Example 7.1 Determining Specifications
for a Discrete-Time Filter
T  104 s
  T
Specifications of the
discrete-time filter in 
1  0.01
 2  0.001
 p  0.4
 p  2 (2000) s  2 (3000)
13
s  0.6
Filter Design Constraints
Designing IIR filters is to find the
approximation by a rational function of z.
The poles of the system function must lie
inside the unit circle(stability, causality).
Designing FIR filters is to find the
polynomial approximation.
FIR filters are often required to be linearphase.
14
Filter Design Techniques
7.1 Design of Discrete-Time IIR
Filters From Continuous-Time Filters
15
7.1 Design of Discrete-Time IIR Filters
From Continuous-Time Filters
The traditional approach to the design
of discrete-time IIR filters involves the
transformation of a continuous-time
filter into a discrete filter meeting
prescribed specification.
16
Three Reasons
1. The art of continuous-time IIR filter
design is highly advanced, and since
useful results can be achieved, it is
advantageous to use the design
procedures already developed for
continuous-time filters.
17
Three Reasons
2. Many useful continuous-time IIR
design method have relatively simple
closed form design formulas.
Therefore, discrete-time IIR filter
design methods based on such
standard continuous-time design
formulas are rather simple to carry
out.
18
Three Reasons
3. The standard approximation methods
that work well for continuous-time
IIR filters do not lead to simple
closed-form design formulas when
these methods are applied directly to
the discrete-time IIR case.
19
Steps of DT filter design by transforming a
prototype continuous-time filter
The specifications for the continuoustime filter are obtained by a
transformation of the specifications for
the desired discrete-time filter.
Find the system function of the
continuous-time filter.
 Transform the continuous-time filter
to derive the system function of the
discrete-time filter.
20
Constraints of Transformation
to preserve the essential properties of the
frequency response, the imaginary axis of the
s-plane is mapped onto the unit circle of the
jw
z-plane.
s  j  z  e
Im
Im
s  plane
Re
21
z  plane
Re
Constraints of Transformation
In order to preserve the property of
stability, If the continuous system has poles
only in the let half of the s-plane, then the
discrete-time filter must have poles only
inside the unit circle.
Im
s  plane
Re
22
Im
z  plane
Re
7.1.1 Filter Design by Impulse
Invariance
The impulse response of discrete-time
system is defined by sampling the impulse
response of a continuous-time system.
hn  Td hc nTd 
Relationship of
frequencies
 
He
if Hc  j  0,    Td
jw
 w
2 
  H c  j  j
k 
Td 
k  
 Td
 w
jw
then H e   H c  j , w  
 Td 

w  Td for w  
23
relation between frequencies
  Td ,     ,    
 w
2
H e   H c  j  j
Td
k  
 Td
if Hc  j  0,    Td then H e jw   H  j w ,
c

T
 d
j
Relationship of
frequencies
S plane 3 / Td
 / Td
- / Td
24
 

jw
Z plane

k 

w 
Aliasing in the Impulse Invariance

 w
2 
jw
    H  j T
He
if Hc  j  0,    Td
 w
then H  e   H c  j  ,
 Td 
w 
jw
25
k  
c

d
j
k 
Td 
Review
st  
periodic sampling

T:sample period; fs=1/T:sample rate



t

nT

n  
Ωs=2π/T:sample rate

xs  t   xc  t  s  t   xc  t     t  nT  
n 
x[n]  xc (t ) |t nT  xc (nT )
26

 x  nT   t  nT 
n 
c
Review
Relation between Laplace Transform
and Z-transform
Time domain:
x(t )
Complex frequency
domain:
s    j
  2f
27
Laplace transform


X ( s)   x(t )e dt
 st

j
0
s  pl ane



X ( s)   x(t )e dt
 st

Since
So
s    j
 0
s  j

j
s- pl ane
0

frequency domain :

X ( j)   x(t )e

 jt
dt

Fourier Transform
Fourier Transform
is the Laplace transform when s
have the value only in imaginary axis, s=jΩ
28
For discrete-time signal,

x(n)  x(t )   (t  nT )   x(nT ) (t  nT )
n 
n
the Laplace transform
L [ x(n)]  


 st
x(n)e dt

  x(nT )   (t  nT )e dt

z-transform
of discretetime signal
29
n


 st

x(nT )e snT  X (e sT )
n 


 x ( n) z  X ( z )
n 
n
令:z
e
sT
L

[ x(n)] 
X ( z) 


x(nT )e snT  X (e sT )
n 
 x(n) z
n
let:z
n  
Laplace transform
continuous time signal
z-transform
ze e
sT

so:
30
e
discrete-time signal
(  j )T
T
r e
  T
T
 e e
jT
sT
relation
 re
relation between
s and z
j
ze e
sT
(  j )T
T
 e e
jT
 re
j
  T  2 f f s
j
z  re |r 1  e
j
X (e ) 

 x ( n )e
n 
j
 j n
DTFT :
Discrete Time
Fourier Transform
j
S plane 3 / Ts
 / Ts
- / Ts
31
Z plane
  Ts  2 f f s  2 f 
0

2

f
/
2
s
:
0  s  2 f s
s  2s
3
Ts

Ts
3

Ts
32
f fs
0 
0  2
2  4
j
s pl ane
fs 
2

2 Ts

:
f
0

z plane
Im[ z ]
r
0

Re[ z ]
discrete-time filter design by impulse invariance
If input is bandlimited and fs>2fmax , :


 H e jT ,
H eff  j   
0,

jw
w  Td for w  
 w
then H  e   H c  j  ,
 Td 
jw
33
 w
2 
H e   H c  j  j
k 
Td 
k  
 Td
if Hc  j  0,    Td
 
hn  Td hc nTd 
  T
  T
w 
relation between frequencies
  Td ,     ,    
 w
2
H e   H c  j  j
Td
k  
 Td
if Hc  j  0,    Td then H e jw   H  j w ,
c

T
 d
j
Relationship of
frequencies
S plane 3 / Td
 / Td
- / Td
34
 

jw
Z plane

k 

w 
Review
st  

 t  nT 
n  
periodic sampling
T:sample period; fs=1/T:sample rate
Ωs=2π/T:sample rate

xs  t   xc  t  s  t   xc  t     t  nT  
n 
x[n]  xc (t ) |t nT  xc (nT )

 x  nT   t  nT 
n 
c
2 
S  j  
    k s 

T k 
1
1 
2 
X s  j  
X c  j  * S  j  
X c  j 
    k s   d



2
2
T k 
1 
  X c  j    k s  
T k 
35
2
S  j  
T
proof of
Review

     k 
k 
s
T:sample period; fs=1/T:sample rate;Ωs=2π/T:sample rate
s(t)为冲击串序列,周期为T,可展开傅立叶级数
st  

 t  nT  
n  
e
jk st

jk s t
a
e
 k
n 
F

 2 (  ks )
2
S  j  
T
36
1  jk st
 e
T n 

     k 
k 
s
periodic sampling

xs  t   xc  t  s  t   xc  t     t  nT  

X s ( j ) 
n 

  x  nT    t  nT e
 n 
c
x[n]  xc (t ) |t nT  xc (nT )
j
X s ( j)  X (e )  T  X (e
X (e
jT
37
)
1 
)   X c  j    k s  
T k 
1 

X (e )   X c 
T k  
j
jT
  2 k  
j 

T 
T
 jt


n 
dt 
X (e j ) 
2
s 
T
xc  nT    t  nT 


k 


n 
xc  nT  e jTn
xc  nT e  jn
1 
X s  j    X c  j    k  s  
T k 
if X (e
jT
)  0,  

T
1
 
then X (e )  X c  j 
T
 T
j
discrete-time filter design by impulse invariance
x[n]  xc (t ) |t nT  xc (nT )
h[n]  hc (nT )
1 

X (e )   X c 
T k  
  2 k  
j 

T 
T
1
 
X (e )  X c  j 
T
 T

1

j
H (e )   H c 
T k  
  2 k  
j 

T
T


1
 
H (e )  H c  j 
T
 T
j
j
j
 w
2
H e   H c  j  j
hn  Td hc nTd 
Td
k  
 Td
if Hc  j  0,    Td
 

jw
 w
then H  e   H c  j  ,
 Td 
jw
38
w 

k 

Steps of DT filter design by transforming
a prototype continuous-time filter
Obtain the specifications for continuoustime filter by transforming the specifications
for the desired discrete-time filter.
Find the system function of the continuoustime filter.
Transform the continuous-time filter to
derive the system function of the discretetime filter.
39
Transformation from discrete to
continuous
In the impulse invariance design
procedure, the transformation is
 
He
jw
 w
 H c  j ,
 Td 
w 
Assuming the aliasing involved in the
transformation is neglected, the
relationship of transformation is
  w Td
40
Steps of DT filter design by transforming
a prototype continuous-time filter
Obtain the specifications for continuoustime filter by transforming the specifications
for the desired discrete-time filter.
Find the system function of the continuoustime filter.
Transform the continuous-time filter to
derive the system function of the discretetime filter.
41
Continuous-time IIR filters
Butterworth filters
Chebyshev Type I filters
Chebyshev Type II filters
Elliptic filters
42
Steps of DT filter design by transforming
a prototype continuous-time filter
Obtain the specifications for continuoustime filter by transforming the specifications
for the desired discrete-time filter.
Find the system function of the continuoustime filter.
Transform the continuous-time filter to
derive the system function of the discretetime filter.
43
Transformation from
continuous to discrete
N
Ak
H s   
k 1 s  sk
N
 Ak e sk t , t  0
hc t    k 1
0,
t0
N
hn  Td hc t    Td Ak e
k 1
N
sk nTd

un   Td Ak e
k 1
N
Td Ak
H z   
sk Td 1
1

e
z
k 1
pole :
s  sk  z  e
sk Td
two requirements for transformation
44
 un
sk Td n
Example 7.2 Impulse Invariance
with a Butterworth Filter
Specifications for the discrete-time filter:
 
0.89125 H e jw  1, 0  w  0.2
   0.17783,
He
jw
0.3  w  
let Td  1  w  Td  
Assume the effect of aliasing is negligible
0.89125 H c  j   1, 0    0.2
H c  j   0.17783,
45
0.3  
Example 7.2 Impulse Invariance
with a Butterworth Filter
0.89125  H c  j   1, 0    0.2
H c  j 0.2   0.89125
H c  j   0.17783,
H c  j 0.3   0.17783
H c  j  
0.3  
1
2
1   j j c 
2N
1   j j c 
2N

1
H c  j 
2N
 0.2 
 1 
1 
 


0.89125


 c 
2N
0.2
46
0.3
 0.3   1 
1 
 


0.17783

 c  
2
2
2
Example 7.2 Impulse Invariance
with a Butterworth Filter
H c  j  
H c  j 0.2   0.89125
1
2
1   j j c 
2N
2N
2
 0.2 
 1 
1 

 1.25893


 c 
 0.89125 


2N
 0.2 

  0.25893
 c 
2N
2N
 0.3   1 2
1 

 31.62204


  c   0.17783 


 0.3 

  30.62204
 c 
N  5.8858, c  0.70470
47
H c  j 0.3   0.17783
2N
3
   118.26378
2
N  6, c  0.7032
Example 7.2 Impulse Invariance
with a Butterworth Filter
1
2
1
H c  j  
H c  s   H c  s  H c  s  
1  j j
2

c
sk  j c  1
1 2N
1  s j c
 j
  ce
N  6,  c  0.7032
H c  s  Plole pairs:
0.182  j 0.679,
0.497  j 0.497,
0.679  j 0.182
48

2N
2 N  2k  N 1
,

2N
k  0,1, ,2 N  1
Example 7.2 Impulse Invariance
with a Butterworth Filter
H c  s   H c  s  H c  s  
2
H c  s  Plole pairs:

1
1  s j c

2N

 c2 N
s c
2N
2N
0.182  j 0.679, 0.497  j 0.497, 0.679  j 0.182
 cN  0.70326
0.12093
Hc  s  
 s  0.182  j0.679 s  0.182  j0.679 s  0.497  j0.497 
1

 s  0.497  j0.497  s  0.679  j0.182 s  0.679  j0.182
H c s  
49
0.12093
s 2  0.3640s  0.4945 s 2  0.9945s  0.4945 s 2  1.3585s  0.4945




Example 7.2 Impulse Invariance
with a Butterworth Filter
0.12093
Hc  s  
 s  0.182  j0.679 s  0.182  j0.679 s  0.497  j0.497 

1
 s  0.497  j0.497  s  0.679  j0.182 s  0.679  j0.182
N
Ak

k 1 s  sk
N
H  z  
k 1
50
N
Td Ak
1 e
skTd
z
1

k 1
Ak
sk
1 e z
1
Td  1
0.2871  0.4466 z 1
2.1428  1.1455 z 1


1
2
1  1.2971z  0.6949 z
1  1.0691z 1  0.3699 z 2
1.8557  0.6303z 1

1  0.9972 z 1  0.2570 z 2
Basic for Impulse Invariance
To chose an impulse response for the
discrete-time filter that is similar in some
sense to the impulse response of the
continuous-time filter.
If the continuous-time filter is bandlimited,
then the discrete-time filter frequency
response will closely approximate the
continuous-time frequency response.
The relationship between continuous-time
and discrete-time frequency is linear;
consequently, except for aliasing, the shape
of the frequency response is preserved.
51
7.1.2 Bilinear Transformation
Bilinear transformation can avoid the
problem of aliasing.
Bilinear transformation maps      
onto    w  
1

2 1 z 
Bilinear transformation: s  

Td  1  z 1 
2
H  z   Hc 
 Td
52
 1  z 
 Hc  s 
2

1  
s
1

z


Td
1
 1  z 1 


1 
1 z 
7.1.2 Bilinear Transformation
2
s
Td
Td 2 s(1 z )  1 z
1
1 Td 2 s]z  1 Td 2 s
1  Td 2s
z
1  Td 2s
1 z 


1 
1 z 
1
s    j
1
1   Td 2  j Td 2
z
1   Td 2  j Td 2
  0  z  1 for any 
  0  z  1 for any 
53
1
7.1.2 Bilinear Transformation
1   Td 2  j Td 2
z
1   Td 2  j Td 2
s    j
1  j Td 2
z
1  j Td 2
Im

s  plane
Re
54
  0  z  1 for any 
  0  z  1 for any 
j  axis s  j
jw 1  j Td 2
e 
z 1
1  j Td 2
Im
z  plane
Re
7.1.2 Bilinear Transformation
2
j 
Td
 jw
 1 e


 jw 
 1 e

 e jw/2 (e jw/2  e jw/2 )  2
  jw/2 jw/2  jw/2 
e
 Td
(
e

e
)


2
  tanw 2
Td
2

Td
w  2 tan1 Td 2
55
1

2 1 z 

s  
1 
Td  1  z 
2
 2 j sin w 2 

  j tan  w 2 
 2 cos w 2  Td
relation between frequency response of Hc(s), H(z)
 
H (e j )  H c ( j)

2
 
tan 
Td
2
prewarp :

56


p 
2

tan
 p 


Td
2



   2 tan  s 
 s Td
 2 

Comments on the Bilinear Transformation
It avoids the problem of aliasing encountered
with the use of impulse invariance.
It is nonlinear compression of frequency axis.
2
  tanw 2
Td
j
S plane 3 / Td
w  2 tan Td 2
1
 / Td
- / Td
57
Z plane
Comments on the Bilinear Transformation
The design of discrete-time filters using
bilinear transformation is useful only when
this compression can be tolerated or
compensated for, as the case of filters
that approximate ideal piecewise-constant
magnitude-response characteristics.
H e 
jw
1
 2
58

 wc
0
wc

2
Bilinear Transformation of
2
s
Td
 1  z 1 


1 
1 z 
2
  
tan  w 2 
Td

59

Td
2
  tanw 2
Td
e
e
 s
 j 
Comparisons of Impulse Invariance
and Bilinear Transformation
The use of bilinear transformation is
restricted to the design of approximations to
filters with piecewise-constant frequency
magnitude characteristics, such as highpass,
lowpass and bandpass filters.
Impulse invariance can also design lowpass
filters. However, it cannot be used to design
highpass filters because they are not
bandlimited.
60
Comparisons of Impulse Invariance
and Bilinear Transformation
Bilinear transformation cannot design
filter whose magnitude response isn’t
piecewise constant, such as
differentiator. However, Impulse
invariance can design an bandlimited
differentiator.
61
7.1.3 Example of Bilinear
Transformation
Butterworth Filter,
Chebyshev Approximation,
Elliptic Approximation
 
0.99  H e jw  1.01,
   0.001,
He
62
jw
w  0.4
0.6  w  
Example 7.3 Bilinear Transformation of a
Butterworth Filter
0.89125  H  e jw   1, 0  w  0.2
2
  tanw 2
Td
jw
H  e   0.17783,
0.3  w  
2
 0.2 
0.89125  H c  j   1, 0    tan 

Td
2


2
 0.3 
H c  j   0.7783,
tan 

Td
 2 
For convenience, we choose Td  1
H c  j 2 tan0.1   0.89125,
H c  j 2 tan0.15   0.17783,
63
0.01 0.016
Example 7.3 Bilinear Transformation of a
Butterworth Filter
H c  j 2 tan0.1   0.89125,
H c  j 2 tan0.15   0.17783,
H c  j 
2
1
1   j jc 
 2 tan  0.1  
1 

c


2N
2N
 3 tan  0.15  
1 

c


64
1




 0.89125 
2N
0.01 0.016
2
1




0.17783


N  5.305
2
N  6,
c  0.766
Locations of Poles
H c  j  
1
2

1  j j c
sk  j c  1
1 2N

2N
 j
  ce
N  6,  c  0.766
H c  s  Plole pairs:
0.1998  j 0.7401,
0.5418  j 0.5418,
0.7401  j 0.1998
65
H c  s   H c  s  H c  s  
2
2 N  2k  N 1
,

1
1  s j c

2N
k  0,1, ,2 N  1
Example 7.3 Bilinear Transformation of a
Butterworth Filter
2N

2
1
c
H c  s   H c  s  H c  s  
 2N
2N
2N
s


c
1  s j c
H c  s  Plole pairs:
0.1998  j 0.7401, 0.5418  j 0.5418, 0.7401  j 0.1998


0.20238
H c s   2
s  0.3996s  0.5871 s 2  1.0836s  0.5871 s 2  1.4802s  0.5871






1 6
0.00073781  z
H z  
1  1.2686z 1  0.7051z 2 1  1.0106z 1  0.3583z 2
1
1


2
1

z

1
2

s  
1  0.9904z  0.2155z
1 



66


Td  1  z 
Ex. 7.3 frequency response of discrete-time filter
67
Example 7.4 Butterworth
Approximation (Hw)
 
0.99  H e jw  1.01,
   0.001,
He
68
jw
w  0.4
0.6  w  
order N  14
Example 7.4 frequency response
69
Chebyshev filters
C
Chebyshev filter (type I)
1
2
| H c ( j) | 
2
2
1   VN ( / c )
1
1 
1
VN ( x)  cos(N cos x)
Chebyshev polynomial
Chebyshev filter (type II)
1
| H c ( j) | 
2
2
1  [ VN ( / c )]1
c
1
2
70

c
Example 7.5 Chebyshev Type I , II
Approximation
   1.01,
0.99  H e
 
jw
H e jw  0.001,
Type I
71
w  0.4
order N  8
0.6  w  
Type II
Example 7.5 frequency response of Chebyshev
Type I
72
Type II
elliptic filters
E
Elliptic filter
1
| H c ( j) | 
1   2U N2 ()
2
Jacobian elliptic function
1
1  1
2
 p s
73
Example 7.6 Elliptic Approximation
 
0.99  H e jw  1.01,
   0.001,
He
74
jw
w  0.4
0.6  w  
order N  6
Example 7.6 frequency response of Elliptic
75
*Comparison of Butterworth, Chebyshev, elliptic filters: Example
-Given specification
0.99  | H (e j ) |  1.01
| H (e j ) |  0.001

|  | 0.4
0.6 |  | 
(s )
1  0.01,  2  0.001  p  0.4 , s  0.6
-Order
B Butterworth Filter : N=14. ( max flat)
C Chebyshev Filter
: N=8. ( Cheby 1, Cheby 2)
E Elliptic Filter
: N=6
( equiripple)
76
-Pole-zero plot (analog)
B
C1
C2
E
C2
E
-Pole-zero plot (digital)
B
(14)
77
C1
(8)
-Group delay
-Magnitude
C1
20
B
B
E
C1
E
C2
5
C2
0.4
78
0.6

0.4
0.6

7.2 Design of FIR Filters by
Windowing
FIR filters are designed based on
directly approximating the desired
frequency response of the discretetime system.
Most techniques for approximating the
magnitude response of an FIR system
assume a linear phase constraint.
79
Window Method
An ideal desired
frequency
response

   h ne
1
h n 
H e e

2
H d e jw 
n  

d

 wc
jw
d
 
H e jw
0
H lp e
d

1
 
 jwn
wc

jwn
dw
jw
1,
w  wc

 0, wc  w  
sin wc n
hlp  n  
n
Many idealized systems are defined by
piecewise-constant frequency response with
discontinuities at the boundaries. As a result,
these systems have impulse responses that
are noncausal and infinitely long.
80
Window Method
The most straightforward approach to
obtaining a causal FIR approximation is to
truncate the ideal impulse response.
hd n, 0  n  M
hn  
otherwise
 0,
hn  hd nwn
1,
wn  
0,
1
jw
H e  
2
81
0nM
otherwise



  

H d e jw W e j  w  d
Windowing in Frequency Domain
Windowed frequency response
 
He
j

  

1
j
j    

H
e
W
e
d
d

2  
The windowed version is smeared version
of desired response
82
Window Method
If
wn  1    n  
   wne

W e jw 
 jwn
 2
n  
1
H e  
2
jw



Hd e

j

W e
j  w  
83

1
4
5 10 15
k  
2
2
0
 w  2k 
W  e jw 
4 2
15 10 5
6 

 wc
d  H d  e jw 
 
H e jw
0
wc

Choice of Window
 wn is as short as possible in duration. This
minimizes computation in the
implementation of the filter.
1,
wn  
0,
0nM
otherwise
 W e jw  approximates an impulse.
W e

jw
   w  n e
n 
 jw M 1
1 e

 jw
1 e
84
 jwn
e
 jwM 2
M
 e
M 1
W  e jw 
 jwn
n 0
sin  w  M  1 2 
sin  w 2 

2
M 1
2
M 1
Window Method
If wn is chosen so that W e jw  is concentrated
in a narrow band of frequencies around w  0
then H e jw  would look like H d e jw  , except
where H d e jw  changes very abruptly.
 
He
jw
M 1

85
2
M 1
1

2
W e
2
M 1
jw



  

 
H d e jw W e j  w  d  H d e jw

1
   wc
H d  e jw 
0
wc

Rectangular Window
W e jw  for the rectangular window has a
generalized linear phase.
M
M 1
W e
jw
e
 jwM 2
sin  w  M  1 2 
sin  w 2 
M 
M 1
As M increases, the width of the “main lobe”
decreases.  wm  4  M  1
While the width of each lobe decreases with
M, the peak amplitudes of the main lobe and
the side lobes grow such that the area under
each lobe is a constant.
M 1
86

2
M 1
2
M 1
Rectangular Window
  H d e jw W e j w  d will oscillate at

the discontinuity.

The oscillations occur more rapidly, but
do not decrease in magnitude as M
increases.
The Gibbs phenomenon can be
moderated through the use of a less
abrupt truncation of the Fourier series.
87
Rectangular Window
By tapering the window smoothly to zero
at each end, the height of the side lobes
can be diminished.
The expense is a wider main lobe and thus
a wider transition at the discontinuity.
88
7.2 Design of FIR Filters by Windowing Method
Review
To design an ilowpass FIR Filters
H e 
1
jw
 
H lp e
jw
1,

 0,
sin wc n
hlp  n  
n
w  wc
wc  w  
sin  wc  n  M 2  
  n  M 2
h n  hd n wn w n  1, 0  n  M
 
He
jw
0, otherwise
1

2



  
M 1
89

H d e jw W e j  w  d

2
M 1
W  e jw 
2
M 1

 wc
0
0
M0 2
wc

M
0
M 2
M
0
M 2
M
7.2.1 Properties of Commonly Used
Windows
Rectangular
1, 0  n  M
wn  
0, otherwise
Bartlett (triangular)
 2n M , 0  n  M 2

wn  2  2n M , M 2  n  M

0,
otherwise

90
7.2.1 Properties of Commonly Used
Windows
Hanning
0.5  0.5 cos2 n M , 0  n  M
wn  
otherwise
 0,
Hamming
0.54  0.46cos2 n M , 0  n  M
wn  
otherwise
 0,
91
7.2.1 Properties of Commonly Used
Windows
Blackman
 0.42  0.5 cos2 n M 

wn    0.08cos4 n M ,
0nM

otherwise
0,
92
7.2.1 Properties of Commonly Used
Windows
93
Frequency Spectrum of Windows
(a) Rectangular, (b) Bartlett,
(c) Hanning, (d) Hamming,
(e) Blackman , (M=50)
94
(a)-(e) attenuation of sidelobe increases,
width of mainlobe increases.
7.2.1 Properties of Commonly Used
Windows
Table 7.1
smallest,the sharpest transition
biggest,high oscillations
at discontinuity
95
7.2.2 Incorporation of Generalized
Linear Phase
In designing FIR filters, it is desirable
to obtain causal systems with a
generalized linear phase response.
The above five windows are all
symmetric about the point M 2 ,i.e.,
wM  n, 0  n  M
wn  
otherwise
 0,
96
7.2.2 Incorporation of Generalized
Linear Phase
Their Fourier transforms are of the form
jw
jw  jwM 2
W e   We e e
jw
We e  is a real and even functionof w
hn  hd nwn : causal
if hd  M  n  hd n
h n  hd n wn
M 2
 h M  n  h n : generalized linear phase
   A e e
He
97
jw
jw
e
 jwM 2
M
7.2.2 Incorporation of Generalized
Linear Phase
if hd M  n  hd n  hn  hd nwn
 hM  n  hn : generalized linear phase
H e
jw
  jA e e
jw
 jwM 2
o
M 2
98
M
Frequency Domain Representation
 
if hd M  n  hd n
   W e e
wn  w M  n
1
H e  
2
jw
1

2
  H e

j
d


j
Ae
e 
jw
jw
jw
 j M 2
 jwM 2
e
 j w  
W e
 d


e
 
99
We
  H e  e

 Ae e jw e jwM
where

 
H d e jw  He e jw e jwM 2
h n  hd n wn
 j w    j w M 2
We  e
d
e


2
1

2
  H e


e
jw

 j w  
We  e
 d


Example 7.7 Linear-Phase Lowpass
Filter
The desired frequency response is
 jwM 2

e
, w  wc
jw
H lp e  
 0, wc  w   H e jw   1   0  w  wp
 
1 wc  jwM 2 jwn
jw
hlp  n  
e
e
dw


H
e
  ws  w  


w
c
2
sin  wc  n  M 2  

for    n  
  n  M 2
 hlp  M  n
100
sinwc n  M 2
hn 
wn
 n  M 2
M 2
magnitude frequency response
H e   1  0  w  w
 p  20log10  p
H e    w  w  
jw
p
p
jw
 s  20log10  s
w  ws  wp
ws
s
s
wp
H  e jw   1  0.05 0  w  0.25
H  e jw   0.1 0.15  w  
 s  20dB
 p  20log10 0.05  26dB
w  ws  wp  0.1
101
7.2.1 Properties of Commonly Used
Windows
biggest,high oscillations
at discontinuity
102
smallest,the sharpest
transition
7.2.3 The Kaiser Window Filter
Design Method

2
 
 I 0   1   n     
 
w  n  
I0   

 0,
where   M 2,

12


, 0nM
otherwise
 u 2
I0 u   1   
r
!
r 1 


r



2
I0 u  : zero  order modified Bessel function of the first kind
two parameters :
shape parameter: 
Trade side-lobe amplitude for main-lobe width
length : M  1,
103
M=20
 =6
As  increases, attenuation of
sidelobe increases, width of
mainlobe increases.
As M increases, attenuation of
sidelobe is preserved, width of
mainlobe decreases.
104
Figure 7.24
(a) Window shape, M=20,
(b) Frequency spectrum, M=20,
(c) beta=6
Table 7.1
Transition width is a little less than
mainlobe width
105
Comparison
If the window is tapered more, the side lobe
of the Fourier transform become smaller, but
the main lobe become wider.
Increasing M wile holding
 constant causes the main
lobe to decrease in width,
but does not affect the
amplitude of the side lobe.
M=20
 =6
M=20
106
Filter Design by Kaiser Window
   1  0  w  w
H e    w  w  
He
jw
jw
s
ws
wp
107
w  ws  wp
A  20log10 
p
Filter Design by Kaiser Window

2
 
 I 0   1   n     
 
w  n  
I0   


 0,
w  ws  wp

12


,
0nM
otherwise
A  20log10 
0.1102 A  8.7 ,
A  50


0.4
  0.5842 A  21  0.07886 A  21, 21  A  50

0.0,
A  21

M=20
108
A8
M
2.285 w
2
Example 7.8 Kaiser Window Design
of a Lowpass Filter
 
0.99  H e jw  1.01,
 
H e jw  0.001,
w  0.4
0.6  w  

2

I 0   1   n     
sin wc  n   
 
 n  
I0   

h  n  
0,
otherwise

12


, 0 n M
where   M 2  18.5
0.1102 A  8.7 ,
A  50


  0.5842 A  210.4  0.07886 A  21, 21  A  50

0.0,
A  21

109
A8
M
2.285w
A  20log10 
w  ws  wp
Example 7.8 Kaiser Window Design
of a Lowpass Filter
0.99  H e jw   1.01, w  0.4
   0.001,
He
jw
0.6  w  
step 1 :
wp  0.4 , ws  0.6 ,
 1  0.01,  2  0.001,   min 1 ,  2   0.001
110
ws  wp
 0.5
step 2 :
cutoff frequency wc 
step 3 :
w  ws  wp  0.2
A  20log10   60
  0.5653
M  37
2
Example 7.8 Kaiser Window Design
of a Lowpass Filter
step 3:
w  ws  wp  0.2
A8
M
 37
2.285w
A  20log10   60
  0.5653
0.1102 A  8.7 ,
A  50


  0.5842 A  210.4  0.07886 A  21, 21  A  50

0.0,
A  21

2 12

I 0   1   n     

sin wc  n   
, 0 n M
 
  n  
I0   

h  n  
0,
111
otherwise
where   M 2  18.5

 u 2
I0 u   1   
r 1 
 r!

r



2
Ex. 7.8 Kaiser Window Design of a Lowpass
Filter
12

2

I 0   1   n     
sin wc  n   
h  n 
 
 n  
I0   
112



, 0 n M
7.3 Examples of FIR Filters Design
by the Kaiser Window Method
The ideal highpass filter with
generalized linear phase
 
H hp e
jw
 0,
w  wc
   jwM 2
, wc  w  
e
 
 
Hhp e jw  e jwM 2  Hlp e jw
sin  n  M 2 sin wc n  M 2
hhp n 

,   n  
 n  M 2
 n  M 2
hn  hhp n wn
113
Example 7.9 Kaiser Window Design
of a Highpass Filter
Specifications:
   , w  w
1    H e   1   ,
He
jw
2
s
jw
1
1
wp  w  
where ws  0.35 , wp  0.5 , 1   21    0.021
By Kaiser window method
  2.6, M  24
114
Example 7.9 Kaiser Window Design
of a Highpass Filter
Specifications:
   , w  w
1    H e   1   ,
He
jw
2
s
jw
1
1
wp  w  
where ws  0.35 , wp  0.5 , 1   21    0.021
By Kaiser window method
  2.6, M  24
115
7.3.2 Discrete-Time Differentiator
 
Hdiff e jw   jwe jwM 2 ,    w  
cos n  M 2 sin  n  M 2
hdiff n 

,   n  
2
n  M 2
 n  M 2
hn  hdiff nwn
hn  hM  n: type III or type IV generalized linear phase
116
Example 7.10 Kaiser Window
Design of a Differentiator
Since kaiser’s formulas were
developed for frequency responses
with simple magnitude discontinuities,
it is not straightforward to apply them
to differentiators.
Suppose M  10   2.4
117
Group Delay
Phase:
M



w   5w 
2
2
2
Group Delay:M
2
118
 5 samples
Group Delay
Phase:
M

5

 w   w
2
2
2
2
Group Delay:M
5
 samples
2
2
Noninteger delay
119
7.4 Optimum Approximations of FIR
Filters
Goal: Design a ‘best’ filter for a given M
In designing a causal type I linear phase
FIR filter, it is convenient first to consider
the design of a zero phase filter.
he n  he  n
Then insert a delay sufficient to make it
causal.
120
7.4 Optimum Approximations of FIR
Filters
he n  he  n
   h ne
Ae e jw 
 
L
n L
 jwn
e
,
LM 2
L
Ae e jw  he 0   2he ncoswn  : real, even, periodic function
n 1
A causal system can be obtained from he n by
delayingit by L  M 2 samples.
hn  he n  M 2  hM  n
   A e e
He
121
jw
jw
e
 jwM 2
7.4 Optimum Approximations of FIR
Filters
Designing a filter to meet these specifications
is to find the (L+1) impulse response values
he n, 0  n  L
Packs-McClellan algorithm is the dominant
method for optimum design of FIR filters.
In Packs-McClellan algorithm, L, wp , ws , and 1  2
is fixed, and 1 or  2  is variable.
122
7.4 Optimum Approximations of FIR
Filters
1
coswn  Tn cosw  cos n cos cosw


cosw0  T cosw  cos0 cos cosw  1
cosw1  T cosw  cos1cos cosw  cosw
1
0
1
1
cosw2  T2 cos w  2 cos w 1
2
coswn   Tn cos w
 2cos wTn1 cos w  Tn2 cos w
cosw3  2cos wcos2w  cos w


 2 cos w 2 cos2 w  1  cos w  4 cos3 w  3 cos w
123
7.4 Optimum Approximations of FIR
Filters
   h 0   2h ncoswn   a cos w
L
Ae e
L
k
jw
e
n 1
e
k 0
k
L
where Px    ak x
k
k 0
Define an approxim ation error function
   A e 
E w  W w H d e
jw
jw
e
where W w is the weighting function
124
 Px  x cos w
7.4 Optimum Approximations of FIR
Filters
 
Hd e
jw
1, 0  w  w p

0, ws  w  
 1 2
  , 0  w  wp
W w   K  1

 1, ws  w  
125
Minimax criterion
Within the frequency interval of the
passband and stopband, we seek a
frequency response Ae e jw  that
minimizes the maximum weighted
approximation error of
Ew  W wH e  A e 
jw
d
min
max Ew 
he n :0 n L
126
wF
jw
e
Other criterions


H 1  min   E w dw 
he n :0 n  L 0


2

H 2  min   E w dw 
he n :0 n  L 0

H 
127
min
max Ew 
he n :0 n L
wF
Alternation Theorem
Let Fp denote the closet subset consisting of
the disjoint union of closed subsets of the
real axis rx.
k
 Px    ak x is an r th-order polynomial.
k 0
 DP x denotes a given desired function of x
that is continuous on Fp
WP x  is a positive function, continuous on Fp
The weighted error is EP x   WP xDP x  Px
The maximum error is defined as
E  max EP x 
128
xFP
Alternation Theorem
A necessary and sufficient condition that be
the unique rth-order polynomial that Px 
minimizes E is that EP x exhibit at least
(r+2) alternations; i.e., there must exist at
least (r+2) values xi in FP such that
x1  x2    xr 2
EP xi   EP xi1    E
and such that
for
i  1,2,, r  1
129
Example 7.11 Alternation Theorem
and Polynomials
Each of these polynomials is of fifth
order.
The closed subsets of the real axis x
referred to in the theorem are the
regions
 1  x  0.1 and 0.1  x  1
WP x   1
130
7.4.1 Optimal Type I Lowpass
Filters
For Type I lowpass filter
L
Pcos w   ak cos w
k
k 0
The desired lowpass frequency response
cos wp  cos w  1 0  w  wp 
1,
D p cos w  
 0,  1  cos w  cos ws ws  w   
Weighting function
1
 ,
cos w p  cos w  1 0  w  w p 
W p cos w   K

 1,  1  cos w  cos ws ws  w   
131
7.4.1 Optimal Type I Lowpass
Filters
The weighted approximation error is
EP cos w  WP cos wDP cos w  Pcos w
The closed subset
0  w  wp
EP x 
is
and ws  w  
or
coswp  cosw  1 and 1  w  cosws
132
7.4.1 Optimal Type I Lowpass
Filters
The alternation theorem states that a set of
coefficients ak will correspond to the filter
representing the unique best approximation
to the ideal lowpass filter with the ratio  
fixed at K and with passband and stopband
edge wp and ws if and only if EP (cosw)
EP (cosw)
exhibits at least (L+2) alternations on
,
i.e., if and only if FP alternately equals plus
and minus its maximum value at least (L+2)
times.
Such approximations are called equiripple
approximations.
1
133
2
7.4.1 Optimal Type I Lowpass
Filters
The alternation theorem states that
the optimum filter must have a
minimum of (L+2) alternations, but
does not exclude the possibility of
more than (L+2) alternations.
In fact, for a lowpass filter, the
maximum possible number of
alternations is (L+3).
134
7.4.1 Optimal Type I Lowpass
Filters
Because all of the filters satisfy the
alternation theorem for L=7 and for
the same value of K  1  2 , it follows
that wpand/or ws must be different for
each ,since the alternation theorem
states that the optimum filter under
the conditions of the theorem is
unique.
135
Property for type I lowpass filters
from the alternation theorem
The maximum possible number of
alternations of the error is (L+3)
Alternations will always occur at wp and ws
All points with zero slop inside the passband
and all points with zero slop inside stopband
will correspond to alternations; i.e., the filter
will be equiripple, except possibly at w  
and w  0
136
7.4.2 Optimal Type II Lowpass
Filters
For Type II causal FIR filter: hn 0  n  M
The filter length (M+1) is even, ie, M is odd
Impulse response is symmetric
hM  n  hn
The frequency response is
  e
He
jw
 jwM 2
 M 1 2

n 0
 
1 
e
bncos w n  

2 
n 1
 
where bn  2hM  1 2  n, n  1,2, , M  1 2
 jwM 2
137
 M 1 2
 M

2hncos w  n 

  2
7.4.2 Optimal Type II Lowpass
Filters
 M 1 2

n 1
M 1 2 ~

 
1 
bncosw n    cosw 2  b ncoswn 
2 
 
 n 0

  e
He
jw
 jwM 2
cosw 2Pcos w
L
where Pw   ak cos w
k
and L  M  1 2
k 0
~
find ak  b n  bn  bn  2hM 1 2  n
138
7.4.2 Optimal Type II Lowpass
Filters
For Type II lowpass filter,
 
Hd e
jw
1

, 0  w  wp

 DP cos w   cosw 2

ws  w  
 0,
 cosw 2

, 0  w  wp
W w  WP cos w   K

 cosw 2, s  w  
139
7.4.3 The Park-McClellan Algorithm
From the alternation theorem, the optimum
filter Ae e jw  will satisfy the set of equation
i 1
jw
jw






W w Hd e  Ae e   1 
140

2
L
1
x
x

x
1
1
1


2
L
1 x
x

x
2
2
2






2
L
1 x
x

x
L2
L2
L2

where xi  cos wi
i  1,2,, L  2
1

W w1   a   H e jw1
 0
d
1    
jw2
a
H
e
1
W w2       d

 

  
jwL 2
L2  
H
e
 1     d
W wL  2  
 

 





7.4.3 The Park-McClellan Algorithm
Guessing a set of alternation frequencies
wi for i  1,2,, L  2
L2

141
 
jwk
b
H
e
k d
k 1
L2
bk  1

k 1 W wk 
k 1
and
wl  wp , wl 1  ws
L2
where
1
bk  
, xi  cos wi
i 1  xk  xi 
ik
7.4.3 The Park-McClellan Algorithm
L 1
 
Ae e jw  Pcos w 
 d x  x C
k 1
L 1
k
k
1
dk  
 bk xk  xL  2 
i 1  xk  xi 
ik
142
k
 d x  x 
k 1
L 1
k
k
,
xk  x cos wk
7.4.3 The Park-McClellan Algorithm
For equiripple lowpass approximation
 10log10  1 2   13
M
2.324w
where w  ws  wp
Filter length: (M+1)
143
7.5 Examples of FIR Equiripple Approximation
7.5.1 Lowpass Filter
 
0.99  H e jw  1.01,
 
H e jw  0.001,
w  0.4
0.6  w  
M  26
unweightedapproxim ation error
 
 
jw

1  Ae e , 0  w  w p
E w 
E A w  

W w 0  Ae e jw , ws  w  
144
Comments
M=26, Type I filter
The minimum number of alternations
is (L+2)=(M/2+2)=15
7 alternations in passband and 8
alternations in stopband
The maximum error in passband and
stopband are 0.0116 and 0.0016,
which exceed the specifications.
145
7.5.1 Lowpass Filter
M=27, , Type II filter, zero at z=-1
w   
The maximum error in passband and
stopband are 0.0092 and 0.00092,
which exceed the specifications.
The minimum number of alternations
is (L+2)=(M-1)/2+2=15
7 alternations in passband and 8
alternations in stopband
146
Comparison
Kaiser window method require M=38
to meet or exceed the specifications.
Park-McClellan method require M=27
Window method produce
approximately equal maximum error in
passband and stopband.
Park-McClellan method can weight the
error differently.
147
7.6 Comments on IIR and FIR
Discrete-Time Filters
What type of system is best, IIR or
FIR?
Why give so many different design
methods?
Which method yields the best result?
148
7.6 Comments on IIR and FIR
Discrete-Time Filters
149
Generalized
Linear Phase
Order
IIR
ClosedForm
Formulas
Yes
No
Low
FIR
No
Yes
High
7.2.1 Properties of Commonly Used
Windows
Their Fourier transforms are concentrated
around w  0
They have a simple functional form that
allows them to be computed easily.
The Fourier transform of the Bartlett
window can be expressed as a product of
Fourier transforms of rectangular windows.
The Fourier transforms of the other
windows can be expressed as sums of
frequency-shifted Fourier transforms of
rectangular windows.(Problem7.34)
150
Homework
Simulate the frequency response
(magnitude and phase) for
Rectangular, Bartlett, Hanning,
Hamming, and Blackman window with
M=21 and M=51
151
Chapter 5 HW
7.2, 7.4, 7.15,
152
返
回2015/4/13
上一页
Zhongguo Liu_Biomedical Engineering_Shandong Univ.
下一页

similar documents