1 lecture 4: march 13, 2007 topic: 1. uniform frequency-sampling methods (cont.)
TRANSCRIPT
1
Lecture 4: March 13, 2007
Topic:1. Uniform Frequency-Sampling Methods
(cont.)
2
1. Nonrecursive FIR Filter Design by DFT Applications (cont.)
2. Nonrecursive FIR Filter Design by Direct Computation of Unit Sample Response
3. Recursive FIR Filter Design
Topics:
Lecture 4: March 13, 2007
3
4.2.3. Uniform Frequency-Sampling Method B. Nonrecursive FIR Filter Design by DFT Applications
4
4.2.3. Uniform Frequency-Sampling Method B. Nonrecursive FIR Filter Design by DFT Applications
• specification of the desired frequency response at a set of equally spaced frequencies,
1
0
( ) ( ) ( )M
k
y n h k x n k
1
0
( ) ( )M
j j k
k
H e h k e
• solving for the unit sample response h(n) of the linear phase FIR filter from these equally spaced specification based on DFT application.
5
Suppose that we specify the frequency response of the filter at the frequencies
2n
n
M
Then, we obtain:
2( ) ( )nj
n
nH e H H H n
M
1
0
( ) ( ) ( )n n
Mj jk
k
H e H n h k e
0,1,2, , 1for n M
0
21
( )M jk
k
n
Mh k e
1
0
( ) ( )M
j j k
k
H e h k e
6
It is a simple matter to identify the previous expression as DFT of h(k):
Thus, we obtain
21
0
( ) ( )nkM j
M
k
H n h k e
( ) ( )H n DFT h k
1( ) ( )h k DFT H n
21
0
1( ) ( )
nkM jM
n
h k H n eM
0,1,2, , 1k M
This expression allows to compute h(k) from H(n), where frequency response is specified at the set of
equally spaced frequencies.
Notice: H(n) has to be specified correctly!
2n
n
M
7
Important property of H(n) :
2 ( ) 2 ( )1 1
0 0
( ) ( ) ( )k M n k M nM Mj j
M M
k k
H M n h k e h k e
2 2 ( ) 21 12
0 0
( ) ( )kM k n knM Mj j jj kM M M
k k
h k e e h k e e
21
0
( ) ( )knM j
M
k
h k e H n
( ) ( )H n H M n ( ) ( )H M n H n
for n= 1, 2, …, M-1 Proof:
8
Frequency response of the linear phase FIR digital filters: 1
2( ) ( )n
n
Mjj
r nH e H e
2( ) ( ) 1n
njnj M
r
nH e H n H e
M
Proof:
12 2M nM nj n j j
M M Mr r
n nH e H e e
M M
2 21
n nj jnj n M M
r r
n nH e e H e
M M
1 2 1
2 22
( ) ( )n
n
M n Mj jj M
r n r
nH e H e H e
M
9
Uniform Frequency-Sampling Method B. : A Review
1. Specification of H(n) by:
2( ) 1
njn M
r
nH n H e
M
( ) ( )H M n H n for n= 1, 2, …, M-1
2. Computation of h(k) by:
21
1
0
1( ) ( ) ( )
nkM jM
n
h k DFT H n H n eM
for k= 0, 1, 2, …, M-1
10
Determine the coefficients h(k) of a linear phase FIR filter of length M=15, frequency response of which satisfies the condition:
1 0,1,2,32
0 4,5,6,715r
nnH
n
Solution:
152 2( ) 1 1
15
nnjjn nM
r r
n nH n H e H e
M
( ) ( )H M n H n for n= 1, 2, …, M-1
Example:
11
(0) 1H
1
1 15 151.2(1) 1
15
j j
rH H e e
15(14) (15 1) (1)
jH H H e
2 2
2 15 152.2(2) 1
15
j j
rH H e e
2
15(13) (15 2) (2)j
H H H e
3 3
3 15 153.2(3) 1
15
j j
rH H e e
3
15(12) (15 3) (3)j
H H H e
152( ) 1
15
njn
r
nH n H e
( ) ( )H M n H n
12
(4) 0H
(5) 0H
(6) 0H
(7) 0H
(11) (15 4) (4) 0H H H
(10) (15 5) (5) 0H H H
(9) (15 6) (6) 0H H H
(8) (15 7) (7) 0H H H
152( ) 1
15
njn
r
nH n H e
( ) ( )H M n H n
13
2 215 1 14
1 15 15
0 0
1 1( ) ( ) ( ) ( )
15 15
nk nkj j
n n
h k DFT H n H n e H n e
for k= 0, 1, 2, …, M-1
14
By using MATLAB (function ifft.m) the following filter coefficients can be obtained:
h(0)=h(14)= -0.0498
h(1)=h(13)= 0.0412
h(2)=h(12)= 0.0667
h(3)=h(11)= -0.0365
h(4)=h(10)= -0.1079
h(5)=h(9)= 0.0341
h(6)=h(8)= 0.3189
h(7)= 0.4667
15
jH e
Example Solution: Magnitude Response
16
4.2.4. Uniform Frequency-Sampling Method C. Nonrecursive FIR Filter Design by Direct Computation of Unit Sample Response
17
4.2.4. Uniform Frequency-Sampling Method C. Nonrecursive FIR Filter Design by Direct Computation of Unit Sample Response
18
4.2.4. Uniform Frequency-Sampling Method C. Nonrecursive FIR Filter Design by Direct Computation of Unit Sample Response
We have shown that
It is more convenient, however, to define the samples H(n) of the frequency response for the FIR filter as
2( ) 1
njn M
r
nH n H e
M
( ) ( )n
jMH n G n e
2( ) 1
n
r
nG n H
M
where
19
2r
nH R
M
( )G k R
( ) ( )H M n H n for n= 1, 2, …, M-1
( ) ( )G n G M n for n= 1, 2, …, M-1
M : even 02
MG
20
Proof: ( ) ( ) ( ) ( )n
jMH n H M n and H n G n e
( ) ( )
( ) ( ) ( )M n M n
j jM MH n G M n e G M n e
( ) ( )M n n
j j jM M MG M n e e G M n e
( ) ( )n
jMH n G n e
( ) ( )n n
j jM MG M n e G n e
( ) ( )G n G M n
for n= 1, 2, …, M-1
21
In the view of the symmetry for the real-valued frequency samples G(n), it is a simple matter to determine an expression for h(k) in terms of G(n). If M is even, we have:
1 1
0 0
1 1( ) ( ) ( )
kn n nkM Mj j jM M M
n n
h k H n e G n e eM M
(2 1)1
0
1( )
n kM jM
n
G k eM
22
In the view of the symmetry for the real-valued frequency samples G(n), it is a simple matter to determine an expression for h(k) in terms of G(n). If M is even, we have:
1 1
0 0
1 1( ) ( ) ( )
kn n nkM Mj j jM M M
n n
h k H n e G n e eM M
(2 1)1
0
1( )
n kM jM
n
G k eM
1 (2 1) ( )(2 1)2
1
1(0) ( )
Mn k M n k
j jM M
n
G G n e eM
( ) ( ) 1,2,..., 1G n G M n for n M
23
Because:
( )(2 1)( )2 ( ) ( )2 ( )
M n kj j M n k M n j M n k j M n
M M M Me e e e
2 22 1
kM nk M n nj j j j j k
M M M M Me e e e e
24
We can get:
1
2
1
1( ) (0) 2 ( )cos 2 1
M
n
nh k G G n k
M M
for k= 0, 1, 2, …, M-1
(2 1) (2 1)1
2
1
1( ) (0) 2 ( )
2
n k n kMj j
M M
n
e eh k G G n
M
25
Thus we can compute h(k) directly from the specified frequency samples G(n) or equivalently, H(n) (method 3). This approach eliminates the need for a matrix inversion (method 1) or for direct DFT computation (method 2) for determining the unit sample response of the linear phase FIR filter from its frequency-domain specification.
26
Thus we can compute h(k) directly from the specified frequency samples G(n) or equivalently, H(n) (method 3). This approach eliminates the need for a matrix inversion (method 1) or for direct DFT computation (method 2) for determining the unit sample response of the linear phase FIR filter from its frequency-domain specification.
27
Thus we can compute h(k) directly from the specified frequency samples G(n) or equivalently, H(n) (method 3). This approach eliminates the need for a matrix inversion (method 1) or for direct DFT computation (method 2) for determining the unit sample response of the linear phase FIR filter from its frequency-domain specification.
28
Summary
on
the Uniform Frequency-Sampling Method 3.
29
1. Unit Sample Response: Symmetrical, 0
/( ) ( ) , 0,1, , 1j k MH k G k e k M
2( ) 1
k
r
kG k H
M
( ) ( )G k G M k
1
1( ) (0) 2 ( )cos 2 1
U
k
kh n G G k n
M M
1
2
MU for M odd
1
2
MU for M even
30
2. Unit Sample Response: Symmetrical, 1
2
/ 2 (2 1) / 21 1
2 2j j k MH k G k e e
1 2 11
2 2
k
rG k H kM
1 1
2 2G k G M k
0
2 1 2 1 1( ) sin
2 2 2
U
k
h n G k k nM M
31
3. Unit Sample Response: Antisymmetrical, 0
/ 2 /( ) ( ) , 0,1, , 1j j k MH k G k e e k M
2( ) 1
k
r
kG k H
M
( ) ( )G k G M k
( 1) / 2
1
2( ) ( )sin 2 1
M
k
kh n G k n for M odd
M M
( / 2) 1
1
1
1( ) 1 ( / 2) 2 ( )sin 2 1
Mn
k
kh n G M G k n
M M
for M even
32
4. Unit Sample Response: Antisymmetrical, 1
2
(2 1) / 21 1
2 2j k MH k G k e
1 2 11
2 2
k
rG k H kM
1 1
; 02 2 2
MG k G M k G for M even
0
2 1 2 1 1( ) cos
2 2 2
V
k
h n G k k nM M
1
2
MV for M odd
1
2
MV for M even
33
Determine the coefficients h(n) of a linear phase FIR filter of length M=15 with symmetrical impulse response, frequency response of which satisfies the condition:
1 0,1,2,32
0 4,5,6,715r
kkH
k
Example:
34
Solution: Unit Sample Response: Symmetrical, 0
/( ) ( ) , 0,1, , 1j k MH k G k e k M
2( ) 1
k
r
kG k H
M
( ) ( )G k G M k
1
1( ) (0) 2 ( )cos 2 1
U
k
kh n G G k n
M M
1
2
MU for M odd
1
2
MU for M even
35
2 2( ) 1 1
15
k k
r r
k kG k H H
M
1 1.2(1) 1 1
15rG H
0 0.2
(0) 1 115rG H
2 2.2(2) 1 1
15rG H
3 3.2
(3) 1 115rG H
(4) (5) (6) (7) 0G G G G
1 0,1,2,32
0 4,5,6,715r
kkH
k
36
1 15 1 147
2 2 2
MU
7
1
1( ) (0) 2 ( )cos 2 1
15 15k
kh n G G k n
( ) (1)cos 2 1152 3
(2)cos 2 1 (3)cos 2 115 15
X n G n
G n G n
1( ) (0) 2 ( )
15h n G X n
37
1 2 3(0) 1 2 cos cos cos
15 15 15 15
11 2 0.9781 0.9135 0.8090
151
1 2( 0.8736) 0.049815
h
Etc. h(0)=h(14)= -0.0498
h(1)=h(13)= 0.0412
0n
h(2)=h(12)= 0.0412
h(3)=h(11)= -0.0365
h(4)=h(10)= -0.1079
h(5)=h(9)= 0.0341
h(6)=h(8)= 0.3189
h(7)= 0.4667
End.
38
jH e
Example Solution: Magnitude Response
39
4.2.5. Uniform Frequency-Sampling Method D. Recursive FIR Filter Design
40
4.2.5. Uniform Frequency-Sampling Method D. Recursive FIR Filter Design
41
4.2.5. Uniform Frequency-Sampling Method D. Recursive FIR Filter Design
An FIR filter can be uniquely specified by giving either its impulse response (coefficients h(k)) or, equivalently, by the DFT coefficients H(n). These sequences are related by the following expressions:
21
0
( ) ( ) ( )nkM j
M
k
H n h k e DFT h k
n=0, 1, …, M-1
21
1
0
1( ) ( ) ( )
nkM jM
n
h k H n e DFT H nM
k=0, 1, …, M-1
42
It has also been shown that H(n) can be regarded as Z-transform of h(k), evaluated at N points equally spaced around the unit circle:
( ) ( ) ( )H n DFT h k H z
2 / 0,1,2, , 1j N nfor z e and n N
43
1 12 / 1
0 0
1( )
M M kj n M
n k
H n e zM
1
0
( ) ( )M
k
k
H z h k z
Thus, the transfer function of an FIR filter can easily be expressed in terms of DFT coefficients of h(k):
2 / 11
2 / 10
11( )
1
Mj n MM
j n Mn
e zH n
M e z
21 1
0 0
1( )
knM M jk M
k n
z H n eM
44
1
2 / 10
1 1( )
1
MM
j n Mn
zH n
M e z
1
2 / 10
1 ( )
1
M M
j n Mn
z H n
M e z
21
2 / 10
1 1( )
1
j n MM
j n Mn
e zH n
M e z
H1(z) H2(z)
1( )
MzH z
M
1
2 / 10
( )
1
M
j n Mn
H n
e z
45
The transfer function H(z) can be expressed in the form:
1 2( ) ( ) ( )H z H z H z
where
1
1( )
MzH z
M
1
2 2 / 10
( )( )
1
M
j n Mn
H nH z
e z
poles !
zeros
46
1( )H z 2 ( )H z
( )H z
( )x n ( )y n
The zeros of the comb filter cancel the poles of the parallel bank of filters, so that in effect the final transfer function contains no poles, but it is in fact FIR filter.
a comb filter and a parallel bank of single-pole filters H(z) can be interpreted as a cascade of
47
Alternative form to
1
2 / 10
1 ( )( )
1
M M
j n Mn
z H nH z
M e z
can be obtained by combining a pair of complex-conjugate poles of H(z) or two real-valued poles to form two-pole filters with real valued coefficients and taking into account .( ) ( )H n H M n
Then, we can obtain in the forms: 2 ( )H z
48
112
2 1 1 21
(0) ( ) ( )( )
1 1 2cos(2 / )
M
k
H A k B k zH z
z k M z z
for M odd
1 12
2 1 1 1 21
(0) ( / 2) ( ) ( )( )
1 1 1 2cos(2 / )
M
k
H H M A k B k zH z
z z k M z z
for M even
A(k) and B(k) are the real-valued coefficients given by
( ) ( ) ( )A k H k H M k
2 / 2 /( ) ( ) ( )j k M j k MB k H k e H M k e
49
Proof:
2 / 1 2 ( ) / 1
( ) ( )
1 1j k M j M k M
H k H M k
e z e z
2 / 1 2 / 1
2 / 1 2 / 1
( ) 1 ( ) 1
1 1
j k M j k M
j k M j k M
H k e z H M k e z C
De z e z
2 / 1 2 / 2 / 1
( ) ( )
1 1j k M j M M j k M
H k H M k
e z e e z
2 / 1 2 / 1
( ) ( )
1 1j k M j k M
H k H M k
e z e z
50
2 / 1 2 ( ) / 1
( ) ( )
1 1j k M j M k M
H k H M k
e z e z
2 / 1 2 / 1
2 / 1 2 / 1
( ) 1 ( ) 1
1 1
j k M j k M
j k M j k M
H k e z H M k e z C
De z e z
2 / 1 2 / 1
2 / 2 / 1
1
( ) 1 ( ) 1
( ) ( )
( ) ( )
( ) ( )
j k M j k M
j k M j k M
C
H k e z H M k e z
H k H M k
H k e H M k e z
A k B k z
51
2 / 1 2 ( ) / 1
( ) ( )
1 1j k M j M k M
H k H M k
e z e z
2 / 1 2 / 1
2 / 1 2 / 1
( ) 1 ( ) 1
1 1
j k M j k M
j k M j k M
H k e z H M k e z C
De z e z
2 / 1 2 / 1
2 / 2 /1 2
1 2
1 1
1 22
21 2cos
j k M j k M
j k M j k M
D
e z e z
e ez z
kz z
M
52
1
2 / 1 2 ( ) / 11 2
( ) ( ) ( ) ( )21 1 1 2cos
j k M j M k M
H k H M k A k B k zke z e z z z
M
Then,
53
Comments on A(k) and B(k) Computation:
1. Because, ( ) ( )H n H M n
( ) ( ) ( ) ( ) ( ) 2Re ( )A k H k H M k H k H k H k R
it can be found that,
54
2 / 2 /( ) ( ) ( )j k M j k MB k H k e H M k e
2 / 2 /( ) ( )kj j k M j k MH k e e H k e
2 / 2 /( ) ( )k kj jj k M j k MH k e e H k e e
2. Let us assume that arg ( )k H k then,
2 / 2 /
2 ( )2
k kj k M j k Me eH k
2 ( ) cos 2 /kH k k M R
55
Summary on A(k) and B(k) Computation:
( ) 2Re ( )A k H k
( ) 2 ( ) cos 2 /kB k H k k M
56
Comments on Quantization Effects:
There is a potential problem in the frequency sampling realization of the recursive FIR filters. These realizations introduce poles and zeros at equally spaced points on the unit circle. In the ideal situation, the zeros cancel the poles and, consequently, the actual zeros of H(z) are determined by the selection of the frequency samples H(k). In a practical implementation, however, quantization effects preclude a perfect cancellation of the poles and zeros. In fact, the locations of poles on the unit circle provide no damping of the round-off noise. As result, such noise tends to increase with time and, ultimately, may destroy computations the normal operation of the filter.
57
Comments on Quantization Effects:
There is a potential problem in the frequency sampling realization of the recursive FIR filters. These realizations introduce poles and zeros at equally spaced points on the unit circle. In the ideal situation, the zeros cancel the poles and, consequently, the actual zeros of H(z) are determined by the selection of the frequency samples H(k). In a practical implementation, however, quantization effects preclude a perfect cancellation of the poles and zeros. In fact, the locations of poles on the unit circle provide no damping of the round-off noise. As result, such noise tends to increase with time and, ultimately, may destroy computations the normal operation of the filter.
58
Comments on Quantization Effects:
There is a potential problem in the frequency sampling realization of the recursive FIR filters. These realizations introduce poles and zeros at equally spaced points on the unit circle. In the ideal situation, the zeros cancel the poles and, consequently, the actual zeros of H(z) are determined by the selection of the frequency samples H(k). In a practical implementation, however, quantization effects preclude a perfect cancellation of the poles and zeros. In fact, the locations of poles on the unit circle provide no damping of the round-off noise. As result, such noise tends to increase with time and, ultimately, may destroy computations the normal operation of the filter.
59
Comments on Quantization Effects:
There is a potential problem in the frequency sampling realization of the recursive FIR filters. These realizations introduce poles and zeros at equally spaced points on the unit circle. In the ideal situation, the zeros cancel the poles and, consequently, the actual zeros of H(z) are determined by the selection of the frequency samples H(k). In a practical implementation, however, quantization effects preclude a perfect cancellation of the poles and zeros. In fact, the locations of poles on the unit circle provide no damping of the round-off noise. As result, such noise tends to increase with time and, ultimately, may destroy computations the normal operation of the filter.
60
To mitigate this problem, we can move both the poles and zeros from the unit circle just inside the unit circle, let us say at radius r=1-x, where x is a very small number. Thus the original system function of the linear phase FIR filter
1
2 / 10
1 ( )( )
1
M M
j n Mn
z H nH z
M e z
The corresponding two-pole filter realization can be modeled accordingly. The damping provided by selecting r<1 ensures that round-off noise will be bounded and thus instability is avoided.
becomes1
2 / 10
1 ( )( )
1
M M M
j n Mn
r z H nH z
M re z
61
Example:
Determine the transfer function of a recursive linear phase FIR filter for M=15. The real-valued frequency response of the filter to be designed has to satisfy the condition:
1 0,1,2,32
0 4,5,6,715r
kkH
k
Solution:
152 2( ) 1 1
15
nnjjn nM
r r
n nH n H e H e
M
62
Step 1: H(n) computation for n= 0, 1, 2, …, (M-1)/2 i.e. n= 0, 1, 2, 3, 4, 5, 6, 7.
1
1 15 151.2(1) 1
15
j j
rH H e e
1
14
15 15
0.
0 150.2(0) 1 1
15
j
rH H e
0 0
2 2
2 15 152.2(2) 1
15
j j
rH H e e
2
2
15
152( ) 1
15
njn
r
nH n H e
63
Step 1 (cont.):
3 3
3 15 153.2(3) 1
15
j j
rH H e e
3
12
15
152( ) 1
15
njn
r
nH n H e
4,5,6,7For n
20 4,5,6,7
15r
nH for n
Because
( ) 0 4,5,6,7H n for n
64
Step 2: A review of basic expressions
1 2( ) ( ) ( )H z H z H z
1
1( )
MzH z
M
1
2
2 20 21
( ) ( ) ( )
M
kk
H z H z H z
20 1
(0)( )
1
HH z
z
1
2 1 2
( ) ( )( )
1 2cos(2 / )k
A k B k zH z
k M z z
( ) 2Re ( )A k H k
( ) 2 ( ) cos 2 /kB k H k k M
65
Step 3: A(k) computation
(1) 2Re (1) -1.9563A H
(2) 2Re (2) 1.8271A H
(3) 2Re (3) -1.6180A H
( ) 2Re ( )A k H k
66
Step 4: B(k) computation
1(1) 2cos 2 /15 2cos 14 /15 2 /15
2cos 16 /15 -1.9563
B
2(2) 2cos 4 /15 2cos 2 /15 4 /15
2cos( 2 /15) 1.8271
B
3(3) 2cos 6 /15 2cos 12 /15 6 /15
2cos 18 /15 -1.6180
B
( ) 2 ( ) cos 2 /kB k H k k M
67
Step 5: 1 20( ) ( )H z and H z computation (M=15):
15
1
1( )
15
zH z
20 1
1( )
1H z
z
1
1( )
MzH z
M
20 1
(0)( )
1
HH z
z
68
Step 6: 2 ( )kH z computation, (M-1)/2=(15-1)/2=7
1
2 1 2
( ) ( )( )
1 2cos(2 / )k
A k B k zH z
k M z z
1
21 1 2
-1.9563+1.9563( )
1 1.8271
zH z
z z
1
22 1 2
1.8271-1.8271( )
1 1.3383
zH z
z z
1
23 1 2
-1.6180+-1.6180( )
1 0.6180
zH z
z z
2 ( ) 0kH z for k= 4, 5, 6, 7.
69
22 ( )H z 23( )H z
21( )H z20 ( )H z
15 1
1 1 2
1 1
1 2 1 2
1 1 -1.9563+1.9563( ) .
15 1 1 1.8271
1.8271-1.8271 -1.6180+1.6180
1 1.3383 1 0.6180
z zH z
z z z
z z
z z z z
Step 7: result H(z)
The different frequency responses and zero-pole plot of the particular transfer functions are given in the next figures.
1( )H z
2 ( )H z
70
20jH e 21
jH e
22jH e 23
jH e
Magnitude Responses 2 ( )xH z
71
Magnitude Responses
1jH e
2jH e
1 2j jH e H e
72
2jH e
Magnitude Response : zoom 2jH e
73
Magnitude Response
1 2j j jH e H e H e
Recursive FIR Filter
Nonrecursive FIR Filter
74
Zero-Pole Plot
Unit Circle
Zeros
Poles