Analog and Digital Filters
637
Example 6.13
Given the following impulse response sequence: hn = [−5 2 3 4 2 −1 3 −1 2 4 3 2 −5] that
corresponds to a digital fi lter.
Determine the following:
a. The type of fi lter
b. By hand calculate its frequency response
c. Create the script fi le Fir_typ1_1 that returns the following plots:
i. h(n) versus n
ii. The fi rst seven a(n)’s terms of H(W), in a tablelike format, and verify the results
obtained in part (b)
iii. H(W) versus W
iv. Zero–pole
ANALYTICAL Solution
Clearly, h(n) = h(N − 1 − n) is a symmetric sequence with N = odd (13), then the fi lter is
an FIR type 1. Then from R.6.120
H W
a n
nW
n
1
1
0
6
( )
( )cos(
)
ϭ
ϭ
∑
where
a 1 (0) = h(6) = 3
a 1 (1) = 2h(6 − 1) + 2h(5) = 2(−1) = −2
a 1 (2) = 2h(6 − 2) = 2h(4) = 2(2) = 4
a 1 (3) = 2h(6 − 3) = 2h(3) = 2(4) = 8
a 1 (4) = 2h(6 − 4) = 2h(2) = 2(3) = 6
a 1 (5) = 2h(6 − 5) = 2h(1) = 2(2) = 4
a 1 (6) = 2h(6 − 6) = 2h(0) = 2(−5)
a 1 (6) = −10
Then
H 1 (w) = a 1 (0) + a 1 (1) cos(W) + a 1 (2) cos(2W) + a 1 (3)cos(3W)
+ a 1 (4)cos(4W) + a 1 (5)cos(5W) + a 1 (6)cos(6W)
H 1 (ω) = 3 − 2cos(W) + 4cos(2W) + 8cos(3W) + 6cos(4W) + 4cos(5W) − 10cos(6W)
MATLAB Solution
% Script file : Fir _ typ1 _ 1
h = [-5 2 3 4 2 -1 3 -1 2 4 3 2 -5];
N = length(h);
n = 0:N-1;
mid = (N-1)/2;
disp(‘****coeff. of H1(w)****’)
disp(‘index n coeff. a(n)‘)
a = [h(mid+1) 2*h(mid:-1:1)];
% generates the a’s coeff.
nn = (0:6)’;
CRC_47760_CH006.indd 637
CRC_47760_CH006.indd 637
7/23/2008 2:26:55 PM
7/23/2008 2:26:55 PM
637
Example 6.13
Given the following impulse response sequence: hn = [−5 2 3 4 2 −1 3 −1 2 4 3 2 −5] that
corresponds to a digital fi lter.
Determine the following:
a. The type of fi lter
b. By hand calculate its frequency response
c. Create the script fi le Fir_typ1_1 that returns the following plots:
i. h(n) versus n
ii. The fi rst seven a(n)’s terms of H(W), in a tablelike format, and verify the results
obtained in part (b)
iii. H(W) versus W
iv. Zero–pole
ANALYTICAL Solution
Clearly, h(n) = h(N − 1 − n) is a symmetric sequence with N = odd (13), then the fi lter is
an FIR type 1. Then from R.6.120
H W
a n
nW
n
1
1
0
6
( )
( )cos(
)
ϭ
ϭ
∑
where
a 1 (0) = h(6) = 3
a 1 (1) = 2h(6 − 1) + 2h(5) = 2(−1) = −2
a 1 (2) = 2h(6 − 2) = 2h(4) = 2(2) = 4
a 1 (3) = 2h(6 − 3) = 2h(3) = 2(4) = 8
a 1 (4) = 2h(6 − 4) = 2h(2) = 2(3) = 6
a 1 (5) = 2h(6 − 5) = 2h(1) = 2(2) = 4
a 1 (6) = 2h(6 − 6) = 2h(0) = 2(−5)
a 1 (6) = −10
Then
H 1 (w) = a 1 (0) + a 1 (1) cos(W) + a 1 (2) cos(2W) + a 1 (3)cos(3W)
+ a 1 (4)cos(4W) + a 1 (5)cos(5W) + a 1 (6)cos(6W)
H 1 (ω) = 3 − 2cos(W) + 4cos(2W) + 8cos(3W) + 6cos(4W) + 4cos(5W) − 10cos(6W)
MATLAB Solution
% Script file : Fir _ typ1 _ 1
h = [-5 2 3 4 2 -1 3 -1 2 4 3 2 -5];
N = length(h);
n = 0:N-1;
mid = (N-1)/2;
disp(‘****coeff. of H1(w)****’)
disp(‘index n coeff. a(n)‘)
a = [h(mid+1) 2*h(mid:-1:1)];
% generates the a’s coeff.
nn = (0:6)’;
CRC_47760_CH006.indd 637
CRC_47760_CH006.indd 637
7/23/2008 2:26:55 PM
7/23/2008 2:26:55 PM
