Professional Documents
Culture Documents
UNIT - I
DISCRETE FOURIER TRANSFORMS (DFT)
1. DIRECT COMPUTATION
2. RADIX-2 FFT
3. DECIMATION-IN-TIME FFT
4. FLOWGRAPHS
6. COMPLEXITY
7. DECIMATION-IN-FREQUENCY FFT
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
THE FFT
{x[n], 0 n N 1}
is defined as
N
X1
X[k] = x[n] WN kn , 0kN 1
n=0
where ✓ ◆ ✓ ◆
j 2⇡ 2⇡ 2⇡
WN = e = cos N + j sin
N N
is the principal N -th root of unity.
N (N 1) complex additions
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
RADIX-2 FFT
The radix-2 FFT algorithms are used for data vectors of lengths
N = 2K . They proceed by dividing the DFT into two DFTs of
length N/2 each, and iterating. There are several types of radix-
2 FFT algorithms, the most common being the decimation-in-time
(DIT) and the decimation-in-frequency (DIF). This terminology will
become clear in the next sections.
Preliminaries
which is derived as
j 2⇡
N ·2
WN2 = e
2⇡
j N/2
=e
= WN/2 .
WN2nk = WN/2
nk
.
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
which is derived as
k+ N2 2⇡ N
WN = ej N (k+ 2 )
2⇡ 2⇡ N
= ej N k · ej N ( 2 )
2⇡
= ej N k · ej⇡
2⇡
= ej N k
= WNk
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
DECIMATION-IN-TIME FFT
x0 [n] = x[2n]
x1 [n] = x[2n + 1]
N
where we used the first identity above. Recognizing that the 2 -pont
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
DFT of x0 [n] and x1 [n] are given by
N/2 1
X
nk
X0 [k] = DFT N {x0 [n]} = x0 [n] WN/2
2
n=0
N/2 1
X
nk
X1 [k] = DFT N {x1 [n]} = x1 [n] WN/2
2
n=0
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
DIT FFT (2)
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
k+ N2
Using WN = WNk derived earlier, we obtain for this example
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
DIT FFT (3)
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
>> X0+W.^(-k).*X1
ans =
492
-58.083 - 49.657i
94 + 2i
38.083 + 38.343i
>>
>> X0-W.^(-k).*X1
ans =
16
38.083 - 38.343i
94 - 2i
-58.083 + 49.657i
ans =
492
-58.083 - 49.657i
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
94 + 2i
38.083 + 38.343i
16
38.083 - 38.343i
94 - 2i
-58.083 + 49.657i
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
FLOWGRAPHS
The flowgraph for the sum and di↵erence operation is called the
butterfly. This unit will be used as a shorthand notation for the
sum and di↵erence, to simplify the flowgraphs for the FFT.
a a+b
b a−b
3. butterflies
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
FLOWGRAPHS (2)
x[0] X[0]
x[2] X[1]
4−PT DFT
x[4] X[2]
x[6] X[3]
x[1] X[4]
−1
W8
x[3] X[5]
4−PT DFT
W−2
8
x[5] X[6]
W−3
8
x[7] X[7]
N
The decomposition of the N -point DFT into two 2 -point DFTs
can be repeated (provided N is divisible by 4).
x[0] X[0]
2−PT DFT
x[4] X[1]
x[2] X[2]
2−PT DFT
W−1
4
x[6] X[3]
x[1] X[4]
2−PT DFT −1
W8
x[5] X[5]
W−2
8
x[3] X[6]
2−PT DFT
W−1
4
W−3
8
x[7] X[7]
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
FULL FLOWGRAPH
x[4] X[1]
x[2] X[2]
W−1
4
x[6] X[3]
x[1] X[4]
W−1
8
x[5] X[5]
W−2
8
x[3] X[6]
W−1
4
W−3
8
x[7] X[7]
Remarks
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
BIT REVERSAL PERMUTATION
Notice that the input for the full DIT radix-2 FFT flowgraph is
permuted.
n binary bit-rev n’
0 000 000 0
1 001 100 4
2 010 010 2
3 011 110 6
4 100 001 1
5 101 101 5
6 110 011 3
7 111 111 7
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
COMPLEXITY
Ac (N ) = 2 Ac (N/2) + N
N
Mc (N ) = 2 Mc (N/2) + 1
2
N
as N complex additions and 2 1 complex multiplications are
required to put the two N/2-point DFTs together. Note that a
2-point DFT is simply a sum and di↵erence:
Mr (N ) = 4 · Mc (N )
Ar (N ) = 2 · Mc (N ) + 2 · Ac (N )
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
which gives
Mr (N ) = 2 N log2 N 4N + 4
Ar (N ) = 3N log2 N 2N + 2
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
COMPLEXITY (2)
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
DECIMATION-IN-FREQUENCY FFT
Splitting this sum into the first N/2 and second N/2 terms gives
N
1 N
X
2 X1
kn kn
X[2k] = x[n] WN/2 + x[n] WN/2
n=0 n= N2
N N
1 1
X
2 X
2
N k(n+ N )
kn
= x[n] WN/2 + x[n + ] WN/2 2
n=0 n=0
2
N N
1
X2 X1
2
N
kn kn
= x[n] WN/2 + x[n + ] WN/2
n=0 n=0
2
X1 ✓ ◆
N
2
N kn
= x[n] + x[n + ] WN/2
n=0
2
⇢
N
= DFT N x[n] + x[n + ] .
2 2
That is, the even DFT values X[2k] for 0 2 k N 1 are given
N N
by the 2 -point DFT of the 2 -point signal x[n] + x[n + N/2].
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
DIF FFT (2)
Splitting this sum into the first N/2 and second N/2 terms gives
N
1 N
X
2 X1
n kn
X[2k + 1] = x[n] WN WN/2 + x[n] WN n WN/2
kn
n=0 n= N2
N N
1 1
X
2 X
2
N (n+ N2 ) k(n+ N )
= x[n] WN n WN/2
kn
+ x[n + ] WN WN/2 2
n=0 n=0
2
N N
X1
2 X1
2
N
n kn
= x[n] WN WN/2 x[n + ] WN n WN/2
kn
n=0 n=0
2
X1 ✓ ◆
N
2
N
= x[n] x[n + ] WN n WN/2
kn
n=0
2
⇢ ✓ ◆
N
= DFT N WN n x[n] x[n + ] .
2 2
That is, the odd DFT values X[2k + 1] for 0 2 k + 1 N 1 are
given by the N
2 -point DFT of the N
2 -point signal WN n (x[n] x[n + N/2]).
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
DIF FLOWGRAPHS
x[0] X[0]
x[1] X[2]
4−PT DFT
x[2] X[4]
x[3] X[6]
x[4] X[1]
−1
W8
x[5] X[3]
4−PT DFT
W−2
8
x[6] X[5]
W−3
8
x[7] X[7]
x[0] X[0]
2−PT DFT
x[1] X[4]
x[2] X[2]
2−PT DFT
W−1
4
x[3] X[6]
x[4] X[1]
−1 2−PT DFT
W8
x[5] X[5]
W−2
8
x[6] X[3]
2−PT DFT
W−3
8
W−1
4
x[7] X[7]
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
FULL DIF FLOWGRAPH
x[0] X[0]
x[1] X[4]
x[2] X[2]
W−1
4
x[3] X[6]
x[4] X[1]
W−1
8
x[5] X[5]
W−2
8
x[6] X[3]
W−3
8
W−1
4
x[7] X[7]
The DIT and DIF radix-2 FFT algorithms are very similar.
1. The DIT and DIF radix-2 FFT algorithms have the same com-
plexity.
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
Other FFT algorithms
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
Operation Counts of the MATLAB fft Command
6 Flops
x 10
2.5
1.5
0.5
0
0 50 100 150 200 250 300 350 400 450 500
N
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
Close up:
4 Flops
x 10
2
1.8
1.6
1.4
1.2
0.8
0.6
0.4
0.2
0
0 5 10 15 20 25 30 35 40 45 50
N
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
the DFT into two DFTs each of length N/2. Likewise for
other composite lengths.
figure(1), clf
plot(1:512,f,’.’)
xlabel(’N’)
title(’Flops’)
axis([0 512 0 2.5e6])
print -deps fftflops_a
figure(2), clf
plot(1:512,f,’.’)
xlabel(’N’)
title(’Flops’)
axis([0 50 0 2.0e4])
print -deps fftflops_b
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
UNIT - II
Design of IIR Filters
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
The Impulse Invariant Method
• In the impulse invariant method, the impulse response of the digital filter,
h[n ] , is made (approximately) equal to the impulse response of an analog
filter, hc (t ) , evaluated at t = nTd , where Td is an (abitrary) sampling period.
Specifically
h[ n] = Td hc ( nTd )
∞
ω 2π k
H (e jω
)= ∑ c T
H j + j
k =−∞ d Td
If H c ( jΩ ) is bandlimited to π / Td , then
H ( e jω ) = H c ( jω / Td ) .
However, all the commonly used prototype analog filters used in the
impulse invariant design method are indeed non-bandlimited. So there is
aliasing. However, the aliasing can be minimized if we over-design the
analog filter (especially in the stop band).
• The picture below illustrates the design procedure. We first specify the
digital filter as shown in the first diagram. Then we map the digital
Fatima Michael College of Engineering & Technology
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
frequency ω onto the analog frequency Ω = ω / Td and make
Hc ( jΩ ) = H ( e j ΩT ) = . Notice from the diagram that we can only control
d
the magnitude of the responses because of the nature of the analog filters
used.
H ( e jω )
1
1− δ1
δ2
ω
ωp ωs π
H c ( jΩ )
1
1− δ1
δ2
Ω
ωp ωs π
Td Td Td
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
• Let H c ( s) be the Laplace transform of hc (t ) , where the complex number
s = σ + jΩ
∑ N Ak e s t k
t ≥0
hc (t ) = k =1
0 t <0,
h[ n] = Td hc (nTd )
N
= Td ∑ Ak e sk nTd u [n ]
k =1 ,
N n
= ∑ AkTd ( e sk Td ) u[n ]
k =1
and
∞
−n
H ( z) = ∑ h[ n] z
n =−∞
∞ N n
= ∑∑ AkTd ( esk Td ) z − n
n = 0 k =1
N ∞ n
= ∑ AkTd ∑ ( z −1esk Td )
k =1 n =0
N
AkTd
=∑ −1 sk Td
k =1 1 − z e
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
• It is observed that the pole sk = σ k + jΩ k in the s-plane is mapped into the
pole
pk = e sk Td
= eσ k Td e jΩk Td
in the z-plane. If all the sk ’s are on the left half of the s-plane, i.e.
σ k < 0, k = 1,2,..., N , then all the pk ’s are within the unit-circle in the z-
plane (i.e. pk < 1 ). This means that a stable analog filter always yields a
stable digital filter with the impulse invariant method.
z ≠ e sTd
in general.
• Example: Design a digital low pass IIR filter with the following
specificiations:
0.89125 ≤ H ( e jω ) ≤ 1, 0 ≤ ω ≤ 0.2π
H ( e jω ) ≤ 0.17783, 0.3π ≤ ω ≤ π
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
Solution
0.89125 ≤ H c ( jΩ ) ≤ 1, 0 ≤ Ω ≤ 0.2π
Hc ( jΩ ) ≤ 0.17783, 0.3π ≤ Ω
Notice that we did not specify an upperlimit for the stopband frequency.
2 1
H c ( j Ω) = 2N
1+ ( )
Ω
Ωc
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
- The 3-dB frequency and the filter order N are solutions of the two
simultaneous equations:
2N 2
0.2π 1
1+ =
Ωc .89125
2N 2
0.3π 1
1+ =
Ωc .17783
- The next step is to find the poles of the Butterworth filter. Note that
1
H c ( s) H c( − s) =
(1 + jΩs c
2N
)
has 2N poles whose locations in the s-plane are depicted in the diagram
below.
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
Mathematically, these poles are
π π 2π ;
rk = 0.7032exp j + + ( k − 1) k = 1,2,...,2N
12 2 12
Half of these poles are the poles of the Butterworth filter. Specifically
we choose those rk ’s on the left-half s-plane to be the poles of H c ( s) .
Consequently the poles of H c ( s) are
− 0.182 ± 0.679 j
− 0.497 ± 0.497 j
− 0.679 ± 0.182 j
0.649 ± 0.524 j
0.535 ± 0.290 j
0.499 ± 0.092 j
6
1 Ω6c
H c ( s) = ∏ = 6
s
k =1
1 − s ∏( s − s ) k
k k =1
0.12093
=
( s 2 + 0.3640s + 0.4945 )( s 2 + 0.9945s + 0.4945 )( s 2 + 1.3585 s + 0.4945 )
6
Ak
=∑
k =1 s − sk
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
- The transfer function of the digital filter H ( z ) is (remember Td = 1 )
N
Ak
H ( z) = ∑ −1 sk
k =1 1 − z e
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
- If Matlab is used to design the above prototype analog filter, first set
Wp=0.2π = 0.62832
Ws=0.3π = 0.94248
Rp=20log10 (0.89125) = −1
Rs=20log10(0.17783) = −15
[N,Wn]=buttord(Wp,Ws,Rp,Rs,'s')
Matlab with return the filter order in N and its 3db frequency Ωc in the
variable Wn. The results I got is N=6, Wp=0.70866. The latter result is
slightly different from Ω c = 0.7032 .
[Z,P,K]=butter(N,Wn,'s')
where the array Z contains the zeros, the array P contains all the poles,
and the variable K is the gain. The poles I obtained for this example are
-6.8451e-001 +1.8341e-001i
-6.8451e-001 -1.8341e-001i
-5.0109e-001 +5.0109e-001i
-5.0109e-001 -5.0109e-001i
-1.8341e-001 +6.8451e-001i
-1.8341e-001 -6.8451e-001i
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
• Example: Repeat the last example using a Chebyshev filter.
2 1
H c ( jΩ) =
1 + ε 2VN2 ( ),
Ω
Ωc
(
VN ( x ) = cos N cos−1 x )
For example, V0 ( x) = 1 , V1 ( x) = x , V2 ( x) = 2 x 2 − 1 . In general,
VN +1 ( x) = 2xVN ( x ) − VN −1 ( x)
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
- We will design a Chebyshev filter such that the passband requirement is
met exactly at Ω = 0.2π . Consequently, Ω c = 0.2π and
1
0.891252 = , or ε = 0.50885 .
1+ ε 2
2
- To determine the filter order N, we calculate H c (0.3π ) for different
values of N and pick the smallest N that exceeds the specification. Note
2
that the requirement is H c (0.3π ) ≤ 0.17783 or H c (0.3π ) ≤ 0.031624 . It can
be shown that
2
N = 3, H c(0.3π ) = 0.04551
2
N = 4, H c (0.3π ) = 0.00694
- The poles of the Chebyshev filter lie on an ellipse in the s-plane with
minor axis aΩ c and major axis bΩ c , where
1 1/ N
a=
2
( α −α −1/ N ) = 0.3646 ,
1 1/ N
b=
2
(α + α −1/ N ) = 1.0644 ,
and
α = ε −1 + 1 + ε −2 = 4.1702 .
σ2 Ω2
2 2
+ 2 2 =1
a Ωc b Ωc
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
where s = σ + j Ω is the complex s variable. In addition to the above
ellipse, we defined the major circle as the circle centered at s = 0 and
with a radius bΩ c . Similarly, the minor circle is the circle centered at
s = 0 and with a radius aΩ c
To locate the poles, we first identify the points on the major and minor
circles that are equally spaced in angle with a spacing of π / N and
arranged in such a way that the points are symmetrically located with
respect to the imaginary axis (but never fall on the imaginary axis) and a
point occurs on the real axis for N odd but not for N even.
The poles of a Chebyshev filter fall on the above ellipse with the
ordinate specified by the points identified on the major circle and the
abscissa specified by the points identified on the minor circle.
The diagram below illustrates how the poles can be located for the case
N=3.
It should be emphasized that only poles on the left-half plane are used in
the transfer function of the filter.
Fatima Michael College of Engineering & Technology
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
- Once all the 4 poles, s1 , s2 , s3 , s4 , are found, the transfer function of the
Chebyshev filter can be written as (please verify)
1 ∏s k
0.038286
k =1
H c (s) = =
1+ ε 2
4
∏ (s − s ) k
(s 2
)(
+ 0.4233s + 0.1103 s 2 + 0.1753s + 0.3894 )
k =1
The magnitude and phase of this transfer function are shown below
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
- If you use Matlab to determine this filter, first set
Wp=0.2π = 0.62832
Ws=0.3π = 0.94248
Rp=20log10 (0.89125) = −1
Rs=20log10(0.17783) = −15
[N,Wn]=cheb1ord(Wp,Ws,Rp,Rs,'s')
[Z,P,K]=cheby1(N,-Rp,Wn,’s’)
The zeros of the filter will be returned in the array Z, the poles stored in
P, and the gain stored in K. What I found for the poles were
-2.1166e-001 +2.5593e-001i
-2.1166e-001 -2.5593e-001i
-8.7673e-002 +6.1788e-001i
-8.7673e-002 -6.1788e-001I
and the gain was K=0.038286. There are no zeros. These results agree
with those obtained through analysis.
- It is interesting to point out the Chebyshev filter has a lower order than
the Butterworth filter in the last example.
Fatima Michael College of Engineering & Technology
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
The Bilinear Transformation Method
• In the impulse invariant method, aliasing occurs when the prototype analog
filter is transformed back into the digital filter. To reduce the distortion
introduced by aliasing, we start off by tightening the specifications on the
digital filter. This is somewhat cumbersome and may lead to several
iterations before the “optimal” filter is found.
• Let H c (s ) be the transfer function of the protype analog filter. The transfer
function H ( z ) of the digital filter is obtained by substituting
2 1 − z −1
s=
Td 1 + z −1
2 1 − z −1
H ( z) = H c −1
T
d 1 + z
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
• The Bilinear transformation can be written alterantively as:
(1+ z ) sT−1
d = 2 (1 − z −1 ) , or
sTd + z −1 sTd = 2 − 2 z −1 , or
( 2 + sTd ) z −1 = 2 − sTd , or
2 + sTd
z= , or
2 − sTd
1 + sT2d
=
1 − sT2d
z=
(1+ ) + j
σ Td
2
ΩTd
2
(1 − ) − j
σ Td
2
ΩTd
2
2 2
(1 + ) + ( ) exp { j arctan ( ) (1 + )}
σ Td
2
ΩTd
2
ΩTd
2
σ Td
2
=
2 2
(1− ) + ( ) exp{− j arctan ( ) (1− )}
σ Td
2
ΩTd
2
ΩTd
2
σ Td
2
= z exp { jθ }
where
2 2
z =
( ) ( )
1 + σT2d + ΩTd
2
2 2
(1 − ) + ( )
σ Td
2
ΩTd
2
and
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
θ = arctan ( ) ( 1+ ) + arctan ( ) (1− )
ΩTd
2
σ Td
2
ΩTd
2
σ Td
2
Observations:
2 ω
Ω= tan
Td 2
These results indicate that the entire left-half s-plane is mapped into a
disc of radius 1 in the z-plane.
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
• Example: Design a digital low pass filter with the following specifications
0.89125 ≤ H ( e jω ) ≤ 1, 0 ≤ ω ≤ 0.2π
H ( e jω ) ≤ 0.17783, 0.3π ≤ ω ≤ π
Solution:
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
ω p = 0.2π , ω s = 0.3π
Ω p = 2tan ( ω p / 2 ) = 0.64984,
Ωs = 2tan (ω s / 2) = 1.0191
0.89125 ≤ H c ( jΩ ) ≤ 1, 0 ≤ Ω ≤ 0.64984
Hc ( jΩ ) ≤ 0.17783, 1.0191 ≤ Ω ≤ ∞
Rp=20log10(0.89125)=-1
Rs=20log10(0.17783)=-15
Wp=0.64984
Ws=1.0191
N=6
Wn=0.76627 ≡ Ω c
To complete the design of the protoype Butterworth filter, we next issue the
Matlab command [Z,P,K]=butter(N,Wn,’s’). The zeros of H c ( s ) will then
be returned in the array Z, the poles in the array P, and the filter gain (same
N
as Ωc ) in the variable K. It was found that there are no zeros, the poles are
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
-7.4016e-001 +1.9832e-001i
-7.4016e-001 -1.9832e-001i
-5.4183e-001 +5.4183e-001i
-5.4183e-001 -5.4183e-001i
-1.9832e-001 +7.4016e-001i
-1.9832e-001 -7.4016e-001I
and the gain is 0.20243. Denoting the poles as s1 , s2 ,..., s6 , the transfer
function of the Butterworth filter is
K
H c (s ) = 6
∏ k =1
(s − sk )
0.20243
=
( s + 0.39665s + 0.58716 )( s + 1.0837s + 0.58716 )( s 2 + 1.4803s + 0.58716)
2 2
This result is very close to that in Example 7.3 of the Text. Compared to
the result obtained under the impulse invariant method, we observe a
noticeable difference in H c ( s) .
Finally, the last step in the design exercise is to map the above transfer
function into a digital filter using Bilinear transformation, i.e.
1 − z −1
H (z ) = H c 2 −1
1+ z
[Zd,Pd,Kd]=bilinear(Z,P,K,1)
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
storing the poles of H ( z ) , and Kd is the gain of H ( z ) . The results I
obtained are:
Kd= 0.00073798
Zd=
-1
-1
-1
-1
-1
-1
Pd =
4.5216e-001 +1.0510e-001i
4.5216e-001 -1.0510e-001i
5.0527e-001 +3.2087e-001i
5.0527e-001 -3.2087e-001i
6.3430e-001 +5.5026e-001i
6.3430e-001 -5.5026e-001I
Calling the 6 zeros as z1 , z2 ,..., z 6 and the 6 poles as p1 , p2 ,..., p6 . Then the
transfer function of the digital filter H ( z ) can be written as
H ( z ) = Kd
∏ (1− z z )
k =1 k
−1
6
∏ (1 − p z )
k =1 k
−1
=
0.00073798 1 + z −1 ( ) ×
(1 − 1.2686 z −1
)(
+ 0.70512 z −2 1 − 1.0105 z −1 + 0.35826z −2 )
1
(1 − 0.90433 z −1
+ 0.21550z −2 )
The result is once again close to that in Example 7-3 of the text.
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
Frequency Transformation of Lowpass IIR Filters
• So far, we focus our discussion on the design of lowpass IIR filters. How
about highpass, bandpass, and bandstop filters?
• The impulse invariant method will not be suitable for the highpass and
bandstop filters because of heavy aliasing.
Fatima Michael College of Engineering & Technology
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
• It is possible to get around the problem by first designing a digital
portotype lowpass filter and then perform an algebraic transformation on
the digital lowpass filter to obtain the desired frequency selective filter.
• The tranfer function of the digital prototype low pass filter is denoted by
H lp ( p ) where p plays the same role as z , the conventional z -transform
variable.
( )
p −1 = G z −1
such that
H ( z ) = H lp ( p )
( )
p −1 = G z −1
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
3. The unit circle in the p-plane is mapped into the unit circle in the z-
plane. So if θ and ω are the frequency variables in the p-plane and the
z-plane, then
e − jθ = G e − jω ( )
Consequently
G ( e− jω ) = 1
and
θ = −R G e − jω .( )
• The most general form of the function G ( z −1 ) that satisfies all the above
requirements is:
z −1 − α k
N
p = G ( z ) = ±∏
−1 −1
−1
; αk < 1
k =1 1 − α k z
z −1 − α
−1
p =
1 − α z −1
− jθ e − jω − α
e =
1 − α e − jω
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
or
− jω e − jθ + α
e =
1 + α e − jθ
=
( e − jθ + α )(1 + α e jθ )
(1 + α e− jθ )(1 + α e jθ )
2α + (1+ α 2 ) cos(θ ) + j (α 2 − 1) sin(θ )
=
1+α 2 + 2α cos(θ )
or
(1 − α 2 ) sin θ
ω = arctan
2α + (1 +α ) cosθ
2
sin (θ p − ω p ) / 2
α=
sin (θ p + ω p ) / 2
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
• Transformations from LP to LP, HP, BP, and BS filters are shown below:
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
(a) low pass, (b) high pass, (c) bandpass, (d) bandstop.
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
• Example: The prototype low pass filter
0.001836(1 + p −1 )4
H lp ( p) =
(1 − 1.5548 p −1 + 0.6493 p −2 )(1 − 1.4996 p −1 + 0.8482 p −2 )
satisfies
0.89125 ≤ H ( e jθ ) ≤ 1, 0 ≤ θ ≤ 0.2π
H ( e jθ ) ≤ 0.17783, 0.3π ≤ θ ≤ π
Determine the corresponding high pass filter that satisfies the requirements
0.89125 ≤ H ( e jω ) ≤ 1; 0.6 π ≤ ω ≤ π
Solution:
The passband frequency of the high pass filter is ω p = 0.6π and the
passband frequency of the digital prototype filter is θ p = 0.2π . So according
to the design formula,
α=
(
cos
θ p +ω p
2 ) = −0.38197
cos ( )
θ p −ω p
2
This means
−1 z −1 + α − z −1 + 0.38197
p =− =
1 + α z −1 1 − 0.38197 z −1
Consequently,
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
H ( z ) = H lp ( p )
( )(
p −1 = − z −1 + 0.38197 / 1− 0.38197 z−1 )
4
0.02426 (1 − z −1 )
=
(1 − 1.0416z −1
+ 0.4019z −2 )(1 − 0.5661z −1 + 0.7647 z −2 )
It should be pointed out that in actual design, the stopband frequency of the
digital prototype filter will be determined by the stopband frequency of the
high pass (or desired) filter. We assume in this example that the stop band
frequency of the high pass filter is mapped into θ s = 0.3π based on
α = −0.38197.
B (z )
H ( z) = ,
A (z )
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
• Different expressions for A( z ) , B ( z ) , and H ( z ) lead to different
implementation structures. For example, if these two polynomials are
written as
N
A( z ) = 1 − ∑ ak z − k
k =1
and
M
B( z ) = ∑ bk z − k ,
k=0
then
M
−k
∑b z
k =0
k
H ( z) = N .
1 − ∑ ak z − k
k =1
This means in the time domain, the input x [ n] and the output y[ n] of the
filter satisfies
N M
y[n ] − ∑ ak y [n − k ] = ∑ b x[ n − k ] ,
k
k =1 k =0
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
M1 M2
∏ (1 − f z ) ∏ (1 − g
k =1
k
−1
k =1
k z −1 )(1 − g*k z −1 )
H (z ) = C N1 N2 ,
∏ (1 − c z )∏ (1 − d z )(1 − d z )
k =1
k
−1
k =1
k
−1 *
k
−1
where C is a constant, the f k ‘s are the real zeros of the transfer function,
the g k ‘s are the complex zeros (which always exist in conjugate pairs), the
ck ’s are the real poles, and the d k ’s are the complex poles (which always
exist in conjugate pairs).
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
For simplicity, we assume that N1 = M 1 = 2 K (K an integer) and N 2 = M 2 .
This means we can combine pairs of real poles and combine pairs of real
zeros and rewrite H ( z ) as
Ns
b0 k + b1k z −1 + b2 k z −2
H (z) = ∏ −1 −2
k =1 1 + a1k z + a2 k z
Ns
= ∏ H k ( z),
k =1
where
b0 k + b1k z −1 + b2 k z −2
H k ( z) =
1 + a1k z −1 + a 2k z −2
and
N s = K + N2 .
This expression for the transfer function enables us to visualize the IIR
filter as the serial concatentation of N s subsystems. Subsequently it leads
to the Cascade implementation structure; see for example the case of
N s = 3 below.
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
• With the Cascade form implementation, the locations of the poles and zeros
will not change dramatically when the aij ’s and the bij ’s are quantized (as
in fixed point implementation). This is in contrast to the Direct form
implementation where the poles and zeros can change substantially because
of quantization. This issue will be discussed in details in Chapter 7 of the
lecture notes.
Ns
e0k + e1k z −1
H ( z) = ∑ −1
k =1 1 − a1k z − a2k z −2
Ns
= ∑ Gk ( s),
k =1
where
e0 k + e1k z −1
Gk (s ) =
1 − a1k z −1 − a2 k z −2
The transfer function suggests that the IIR filter can be viewed as a “large”
system comprising of N s parallel subsystems. The input to all the
subsystems is x[n ] and the output of the IIR filter, y[ n] , is the sum of the
yk [ n] ’s , the individual outputs of the subsystems.
The figure below shows this parallel form of the IIR filter.
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
• The parallel form offers robustness against quantization error for the poles.
The zeros, however, will be affected by the shifting of the poles in the
individual subsystems.
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
UNIT- III
www.studentsfocus.com
ℑ{z}
• Complex zeros zk and poles pk Occurs in quadruples
z−plane
occur in conjugate pairs. Occurs in conjugate pairs
www.studentsfocus.com
• Causal filters are normally assumed, hence IIR filters are commonly
written as:
M
P
aiz −i
i=0 A(z −1 )
H(z) = N
P
= B(z −1)
, b0 = 1
1+ bj z −j
j=1
|H(eȷθ )| |H(eȷθ )|
Band−pass Filter All−pass Filter
|H(eȷθ )| φ(θ)
High−pass Filter Phase Characteristics
θ rad
k
poles and zeros will occur in conjugate pairs if θk ̸= 0 or π.
Im[z]
Unit Circle
Re[z]
a 1/a
jθ
! e−jθ − a !2 ! cos θ − a − j sin θ !2 1 − 2a cos θ + a2
2
|H1(e )| = ! ! =! ! = =1
1 − ae−jθ 1 − a cos θ + aj sin θ 1 − 2a cos θ + a2
www.studentsfocus.com
1 ±jθk
# The poles are at p1,2 = rk e±jθk and the zeros at z1,2 = rk e
Im[z]
www.studentsfocus.com
Unit Circle 1
X θ 1/r
X −θ
Re[z]
r
Hence
|H2(ejθ )|2 = rk−4 = c (3)
where c is a constant, implying that it represents an all-pass filter.
N
X −1
−n
H(z) = h(n)z (4)
n=0
The filter will have linear phase response if the FIR digital filter satisfies
N −3
X2 ˘ ¯
−jnθ −j(N −1−n)θ ` N − 1 ´ −j n−[
(N −1)
] θ
= [h(n)e + h(N − 1 − n)e ]+h e 2
n=0
2
N −3
X2 ˘ ¯
−jnθ −j(N −1−n)θ ` N − 1 ´ −j n−[
(N −1)
] θ
= h(n)[e +e ]+h e 2 (6)
n=0
2
N −3
X2 ˘ ¯ ˘ ¯
−j[(N −1)/2]θ ˘ N −1 ¯
(N −1) (N −1)
−j n−[ ] θ j n−[ 2 ] θ]
= e h( )+ h(n)[e 2 +e
2 n=0
N −3
X2
−j[(N −1)/2]θ ˘ N −1 N −1 ¯
= e h( )+ 2h(n) cos [(n − )θ] (7)
2 n=0
2
(N
2 −1)
jθ −j[(N −1)/2]θ ˘
X N −1 ¯
H(e ) = e 2h(n) cos [(n − )θ] (8)
www.studentsfocus.com
n=0
2
In both cases, the phase φ(θ) of the FIR digital filter is given by
N −1
φ(θ) = θ (9)
2
which is linear for π < θ ≤ π .
′ N −1
τ (θ) = φ (θ) = (10)
2
which is constant for π < θ ≤ π .
N
X −1
−(N −1) N −n−1
H(z) = z h(n)z
www.studentsfocus.com
n=0
N
X −1
H(z) = z −(N −1)
h(N − m − 1)z m
n=0
N
X −1
−(N −1) −1 −m
= z h(m)(z ) (11)
n=0
−(N −1) −1
= z H(z )
This means that zeros of H(z) are the zeros of H(z −1) except, perhaps, for the zeros at
origin.
Im[z]
www.studentsfocus.com
Unit Circle
Re[z]
a 1/a
Im[z]
Unit Circle
Re[z]
Im[z]
www.studentsfocus.com
Unit Circle
θi
Re[z]
θi
N
X −1
j2πnk
e [− ]
H(k) = h(n)e N (12)
n=0
www.studentsfocus.com
e
where H(k) is actually the uniformly spaced N-point sample sequence of the
frequency response of the digital filter. As a consequence, the impulse response
sequence h(n) and transfer function H(z) are given by
N −1
1 X e [
j2πnk
]
h(n) = H(k)e N (13)
N k=0
and
N −1
1 X e 1 − z −N
H(z) = H(k) j2πk
(14)
N k=0 1−z e N ]
−1 [
where equation (14) is the key to the design of FIR digital filter.
Example
Design a low-pass digital filter whose magnitude characteristics are shown in Figure. Find
an appropriate transfer function via a 16-point frequency sampling method.
Hd(ejθ ), H̃(k)
www.studentsfocus.com
1
Hd(ejθ )
0 π 2π θ
0 5 10 15 k
Example
e
H(0) e
= H(1) e
= H(15) =1
e
H(k) = 0 for k = 2, 3, 4, . . . , 14 (15)
www.studentsfocus.com
15 e
1 ˆ X (1 − z −16)H(k) ˜
H(z) =
16 k=0 1 − z −1e jkπ
8
1 − z −16 ˆ 1 1 1 ˜
= j0π
+ jπ
+ j15π
(16)
16 −1
1−z e 4 −1
1−z e 8 −1
1−z e 8
1 − z −16 ˆ 1 2(1 − z −1 cos(π/8)) ˜
= +
16 1 − z −1 1 − 2z −1 cos(π/8) + z −2
It can be be shown that the frequency response of (17) will be equal to the specifications
of (15) at the sampling frequencies θ = kπ
8 for k = 0, 1, 2, . . . , 15.
n=−∞
where Z π
1 jθ jθn
h(n) = H(e )e (18)
2π n=−π
where h(n) is the impulse response of the digital filter.
• While the infinite series in (17) can be truncated to obtain the digital filter, the Gibbs
phenomenon states that the truncation will cause overshoots and ripples in the
desired frequency response.
• In the method of windowing, a finite weighting sequence w(n), called windows, is
used to obtain the finite impulse response hD (n), where
hD (n) = h(n)w(n)
where w(n) is w(n) = 0 for n > N and n < 0.
The windowing method has the effect of smoothing out the ripples and
overshoots in the original frequency response as shown in the figure for a
simple window function
θ rad θ rad
π π
2πn
w(n) = 1 + cos for 0 ≤ n ≤ N − 1
N
= 0 otherwise (19)
functions
• Rectangular Window
w(n) = 1 for 0 ≤ n ≤ N − 1
= 0 otherwise (20)
www.studentsfocus.com
2n
w(n) = for 0 ≤ n ≤ (N − 1)/2
N −1
2n
= 2− for (N − 2)/2 ≤ n ≤ N − 1 (21)
N −1
= 0 elsewhere
where N is even.
functions
• Hann Window
1" 2πn #
www.studentsfocus.com
• Hamming Window
" 2πn #
w(n) = 0.54 − 0.46 cos for 0 ≤ n ≤ N − 1
N −1
= 0 elsewhere (23)
functions
• Blackman Window
" 2πn # " 4πn #
w(n) = 0.42 − 0.5 cos + 0.008 cos for 0 ≤ n ≤ N − 1
N −1 N −1
= 0 elsewhere (24)
www.studentsfocus.com
• Kaiser Window
$%
N −1 2 N −1 2
" & % & #
I0 wa 2 − n− 2
w(n) = " % N −1 &# for 0 ≤ n ≤ N − 1
I0 wa 2
= 0 elsewhere (25)
where I0(.) is a modified zeroth order Bassel function of the first kind
and wa is a window shaper parameter.
x[n] = 0.1 sin(n ∗ 0.2π + Φ1) + sin(n ∗ 0.3π + Φ2) + w[n] N = 128
' n(
Hamming window w[n] = 0.54 − 0.46 cos 2π
www.studentsfocus.com
15 20
10 10
5
0
Magnitude (dB)
Magnitude (dB)
0
−10
−5
−20
−10
−30
−15
−40
−20
−25 −50
−30 −60
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
Frequency (units of pi) Frequency (units of pi)
N U !n=−∞
!
!
1
2
*N −1
where N is the window length and U = n=0 |w[n]| is a constant,
N
and is defined so that P̂M (ω) is asymptotically unbiased.
In Matlab:-
xw=x(n1:n2).*w/norm(w);
Pm=N * periodogram(xw);
w=hanning(N); w=bartlett(N);w=blackman(n);
“Cosine–type windows”
Idea:- suppress sidelobes, perhaps sacrify the width of mainlobe
• Hann window
www.studentsfocus.com
w = 0.5 * (1 - cos(2*pi*(0:m-1)’/(n-1)));
• Hamming window
w = (54 - 46*cos(2*pi*(0:m-1)’/(n-1)))/100;
• Blackman window
w = (42 - 50*cos(2*pi*(0:m-1)/(n-1)) +
+ 8*cos(4*pi*(0:m-1)/(n-1)))’/100;
• Unlike IIR filters, FIR filters can be designed to have linear phase
www.studentsfocus.com
characteristics.
• FIR filters are, however, computationally more expensive than IIR filters
and hence are called for to perform tasks not possible/or not practical
by IIR filters such as linear phase, and multirate filters.
UNIT - IV
FINITE WORD LENGTH EFFECTS IN DSP
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
ABSTRACT
We know that computers store numbers not with infinite precision but rather in
some approximation that can be packed into a fixed number of bits or bytes, because of
which we are loosing some information. Our aim is to study the effect of loosing this
information on the response of digital filters. This effect we called Finite word length
effect.
There are number of effects of finite word length like overflow error in addition,
round off error in multiplication, effects of coefficient quantization, limit cycle, etc. This
paper talks about effects on response of IIR filters for the case of coefficient quantization.
Section 1 gives brief introduction to number system and shows why finite word
length effect occurs. Section 2 studies same phenomena from the view point of filters it
also includes results we have obtained.
We have studied effect of finite word length on the response of Butterworth low
pass IIR filter. Also we have studied effect of finite word length on the response of 4th
order IIR filter for direct form and parallel form realization. On the basis of results we
have concluded well known result that parallel form realization is better than direct form
realization.
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
1. INTRODUCTION
Computers store numbers not with infinite precision but rather in some
approximation that can be packed into a fixed number of bits or bytes. Almost all
computers allow the programmer a choice among several different such representations
or data types. Data types can differ in the number of bits utilized, but also in the more
fundamental respect of whether the stored number is represented in fixed-point or
floating-point format.
Where, Xm is an arbitrary scale factor and bi’s are either 0 or 1. The quantity b0 is referred
to as sign bit. If b0 = 0, then 0 ≤ x ≤ Xm and if b0 = 1, then Xm ≤ x < 0.
An arbitrary real number x would require an infinite number of bits for its exact
binary representation. If we use only a finite number of bits (B+1), then the
representation of above equation must be modified to
B
xˆ = QB [ x] = X m (−b0 + ∑ bi z − i ) = X m xˆ B
i =1
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
Figure 1.1 Nonlinear Relationship representing two’s complement (a) rounding and
(b) truncation for B = 2 [1]
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
Figure 1.2 probability density function for quantization errors (a) Rounding (b)
Truncation. [1]
If a number is larger than Xm, a situation called overflow occurs. Figure 1.3 (a)
shows two’s complement quantizer, including the effect of regular two’s complement
arithmetic overflow. An alternative, which is called saturation overflow or clipping, is
shown in figure 1.3 (b). This method of handling overflow is generally implemented for
A/D conversion, and it sometimes is implemented in specialized DSP microprocessor for
addition of two’s complement numbers. With saturation overflow, the size of the error
does not increases abruptly when overflow occurs; however disadvantage of such
methods is that it voids the property of two’s complement-arithmetic that ‘If several
two’s-complement numbers whose sum would not overflow are added, then the result of
two’s-complement accumulation of these numbers is correct even though intermediate
sums might overflow”.
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
Figure 1.3 Two’s complement rounding (a) Natural Overflow (b) Saturation. [1]
x = −1s ∗ 2 E −127 ∗ 1. f
where E is eight bit exponent (0 < E <255), s is sign bit ( 0 for positive and 1 for negative
2 23 − 1
) and f is 23 bit fraction (0 < f < ) . Floating point representations provide a
2 23
convenient means for maintaining wide dynamic range.
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
• Sampling/Digitization Error
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
summing a finite number of leading terms in its infinite series, rather than all infinity
terms. In cases like this, there is an adjustable parameter, e.g., the number of points or of
terms, such that the “true” answer is obtained only when that parameter goes to infinity.
Any practical calculation is done with a finite, but sufficiently large, choice of that
parameter. The difference between the true answer and the answer obtained in a practical
calculation is called the truncation error. Truncation error would persist even on a
hypothetical, “perfect” computer that had an infinitely accurate representation and no
round off error.
• Overflow in addition
Overflow in addition of two or more binary numbers occurs when the sum
exceeds the word size available in the digital implementation of the system.
• Limit cycles
Since quantization inherent in the finite precision arithmetic operations render the
system nonlinear, in recursive system these nonlinearities often cause periodic oscillation
to occur in the output, even when input sequence is zero or some nonzero value. Such an
oscillation in recursive systems are called limit cycles.
As explained in above paragraphs finite word length affects LTI system in many
ways. We have concentrated on effects due to coefficient quantization on filter response
and in that also on IIR filters. Later we have given brief overview of effects of coefficient
quantization in FIR system for the sack of completeness.
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
∑b z k
−k
H (z) = k =0
N
1 − ∑ ak z − k
k =1
The sets of coefficients {ak} and {bk} are ideal infinite-precision coefficients. If
we quantize these coefficients, we obtain the system function
M
∑ bˆ k z −k
Hˆ ( z ) = k =0
N
1 − ∑ aˆ k z − k
k =1
where âk = ak + ∆ak and bk = bk + ∆bk are the quantized coefficients that differ from
original coefficients by quantization by quantization error ∆ak and ∆bk.
Kaiser showed that if poles (or zeros) are tightly clustered it is possible that small
error in denominator (numerator) coefficient can cause large shifts of the poles and
(zeros) for direct form structure. Thus, if the poles (zeros) are tightly clustered,
corresponding narrow band pass filter or narrow-bandwidth low pass filter, then we can
express poles of the direct-form structure to be quite sensitive to quantization error in the
coefficients. Kaiser analysis also showed that the larger the number of clustered poles
(zeros), the greater is the sensitivity to quantization error.
The cascade and parallel form system function is consists of second order direct-
form systems. However, in both cases each pair of complex conjugate poles pair is
realized independently of all other poles. Thus, the error in a particular pole pair is
independent of its distance from the other poles of system function.
For the cascade form same arguments holds for the zeros, since they are realized
as independent second order factors. Thus cascade form is generally much less sensitive
to coefficient quantization than the equivalent direct-form realization.
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
( N +1) / 2
b0 k + b1k z −1 + b2 k z −2
H ( z) = ∏
k =1 1 − a1k z −1 − a2 k z −2
The zeros of the parallel form structure are realized implicitly through combining
the quantized second order sections. Thus, particular zero is affected by quantization
error in the numerator and denominator coefficients of all the second order sections.
However for most practical filter the parallel form is also found to be much less sensitive
to coefficient quantization than the equivalent direct-form realization.
M −N ( N +1) / 2
e0 k + e1k z −1
H ( z) = ∑C z
k =0
k
−k
+ ∑k =1 1 − a1k z −1 − a2 k z −2
In summery, because of the sensitivity to finite word length effect, the direct
forms are rarely used for implementing anything other than second - order structures.
Cascade and parallel structures are more often used.
Before jumping on to designing of filters and seeing finite word length effect let
us explain what we have did. Here we are not going to explain designing of filters or any
other filter designing fundamentals, one can refer any good book available for same[1][2].
But one should ask how we did quantization, so let us explain how we did quantization
and give some examples which show capability and limitation of our routine.
Our quantization routine is very simple and it basically performs following steps:
1) Take 32 bit floating point number between ranges 0 to 2.
2) Multiply it with 231 – 1 (if your numbers are between 0 to 1 then multiply it with
232 – 1) to get equivalent integer number stores it in 32 bit format
3) Shift above number required number of bits as per requirement to obtain N bits
representation of corresponding number (In a way make zero least significant
32 – N bits. So we have number which is still in 32 bits but least significant bits
removed).
4) Convert above number back into corresponding floating point number.
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
Below we have given out C program routine which takes as input floating point
number which we want to quantize and desire bit representation and gives as output
corresponding floating point number in desire bit representation.
=====================================================================*/
{
unsigned long int icof=0,m;
int sign = 1;
float fract,quan;
return(quan);
}
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
Examples:
Before starting let’s see how much 1 bit represents (Note: below examples are
considering numbers between range 0 to 1). :
1
= 2.3283064370807973754314699618685e - 10
2 −1
32
30 bits -1.0000000000
16 bits -0.9999847412
8 bits -0.9960937500
We are not using
32 bits 0.4919821918
full dynamic range
30 bits 0.4919821918
0.4919822006 24 bits 0.4919821620
16 bits 0.4919738770
8 bits 0.4882812500
Let us start with fundamental steps needed to design Butterworth low pass filter
using bilinear transformation. Description is very brief just to give basic idea:
frequency.
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
⎢ 2 − 1⎥
⎣δ 1 ⎦
4) The transfer function of Butterworth filter is usually written in the factored as given
below
N/2
Bk Ω c2
H (s) = ∏ N = 2, 4, 6, …
k =1 s 2 + bk Ω c s + ck Ω c2
Or
B0 Ω c ( N −1) / 2
Bk Ω c2
H ( s) =
s + c0 Ω c
∏k =1 s 2 + bk Ω c s + c k Ω c2
N = 3, 5, 7, …
And
( N −1) / 2
A= ∏B
k =1
k , for odd N
5) Determination of H(z)
H ( z ) = H ( s) | 2 ( z −1)
s=
T ( z +1)
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
Filter parameters:
Pass band ripple: 0.99
Stop band ripple: 0.001
Pass band frequency: 1.2566
Stop band frequency: 1.885
Filter Order: 14 (so total seven 2nd order filters are there)
Cutoff Frequency: 1.672363
Filter coefficient:
Numerator coefficients are BB1-7 = Bk Ω c2
Note: In above table don’t get confused by values of coefficients. It may seem they are going beyond range 0-2 but
actually it’s because of multiplication with Ω c term. See the equation of H(s)
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
2.1.3 Designing of 4th order low pass filter and to show response of filter while direct
realization and parallel form realization
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
Coeffi Original Quantized value Quantized value Quantized Quantized value Quantized value
cients Value – 24 bits – 12 bits value – 8 bits – 6 bits – 4 bits
Coeffici Original Quantized Quantized value Quantized Quantized value Quantized value
ents Value value – 24 bits – 12 bits value – 8 bits – 6 bits – 4 bits
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
For FIR system, we have to concerned with locations of zeros only, since for
causal FIR system all poles are at z = 0. Although we have just seen that direct form
structure should be avoided for high order IIR system, it turns out that direct form
structure is commonly used for FIR systems. To understand why this is so, we express
the system function for a direct form FIR system in the form
M
H (z) = ∑ h[ n ] z
n=0
−n
Now suppose that the coefficients {h[n]} are quantized, resulting in a new set of
coefficients {ĥ[n] = h[n] + ∆h[n]}. The system function for quantized system is then
M
Hˆ ( z ) = ∑ h[n] z − n = H ( z ) + ∆H ( z )
n=0
Where
M
∆H ( z ) = ∑ ∆h[n]z − n
n=0
Thus, system function of the quantized system is linearly related to the quantization
errors in the impulse response coefficients.
If the zeros of H (z) are tightly clustered, then their locations will be highly
sensitive to quantization errors in the impulse response coefficients. The reason that
direct form FIR system is widely used is that for most linear phase FIR filters, the zeros
are more or less uniformly spread in the z-plane.
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
Fig 2.17 FIR quantization example (a) Log magnitude for unquantized case;
Approximation error for (b) unquantized case (c) 16 bit quantization [1]
Fig 2.17 (continued) Approximation error for (d) 14 bit quantization (e) 13 bit
quantization (f) 8 bit quantization [1]
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
CONCLUSION
Finite word length is inherent problem which occur due to finite bit representation
of number in digital representation. Effect of finite word lengths are Overflow in
addition, Limit cycles and Round off noise in multiplication. We have seen effect of
coefficient quantization on filter response. Also we have conclude that coupled form and
parallel form structure of filter realization are more secure against finite word length
effect as compare to direct form realization.
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
There is a requirement to process the various signals at different sampling rate e.g.,
Teletype, Facsimile, speech and video, etc., The discrete time systems that process data at more
than one sampling rate are known as multirate systems.
Example:
• High quality data acquisition and storage
• Audio and video signal processing
• Speech processing
• Narrow band filtering for ECG/EEG
• Transmultiplexers
Sampling rate conversion can be done in i) analog domain and ii) digital domain. In analog
domain using DAC the signal is converted into analog and then filtering is applied. Then the analog
signal is converted back to digital using ADC. In digital domain all processing is done with signal in
digital form.
In the first method, the new sampling rate doesn’t have any relationship with old sampling
rate. But major disadvantage is the signal distortion. So the digital domain sampling rate conversion
is preferred even then the new sampling rate depends on the old sampling rate.
The two basic operations in multirate signal processing are decimation and interpolation.
Decimation reduces that sampling rate, whereas interpolation increases the sampling rate.
Down sampling:
The sampling rate of a discrete time signal x(n) an be reduced by a factor M by taking every
Mth value of the signal.
A downsampler
The output signal y(n) is a downsampled signal of the input signal x(n) and can be
represented by
y(n) = x(Mn)
Example:
x(n) = {1, -1, 2, 4, 0, 3, 2, 1, 5, ….}
if M = 2
y(n) = {1, 2, 0, 2, 5, ….}
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
Up sampling:
The sampling rate of a discrete time signal can be increased by a factor L by placing L-1
L
equally spaced zeros between each pair of samples. Mathematically, upsampling is represented by
n
x n = 0, ± L, ± 2 L......
y((n) = L
0 otherwise
Example:
x(n) = {1, 2, 4, -2,
2, 3, 2, 1, …..}
if L = 2
y(n) = x(n/2) = {1, 0, 2, 0, 4, 0, -2, 0, 3, 0, 2, 0, 1, …..}
In practice, the zero valued samples inserted by upsampler are replaced with appropriate
non-zero
zero values using some type f filtering process. This process is called interpolation
interpolation.
The transfer function H(z) of the polyphase FIR filter is decomposed into M branches given
by
M −1
H ( z ) = ∑ z −m pm ( z M )
m=0
N +1
m
Where p m ( z ) = ∑ h( Mn + m) z −n
n =0
∞
H ( z) = ∑ h(n) z
n = −∞
−
−n
M −1 ∞
H ( z) = ∑ ∑z −m
h( rM + m) z − rM
m =0 r = −∞
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
M −1 ∞
H ( z) = ∑ ∑ h(rM + m) z − ( rM + m )
m= 0 r = −∞
let h( Mn + m) = pm (r )
M −1 ∞
H ( z ) = ∑ ∑ p m ( r ) z −( rM + m )
m = 0 r = −∞
M −1 ∞
Y ( z ) = ∑ ∑ pm ( r ) X ( z ) z −( rM + m )
m = 0 r = −∞
M −1 ∞
y (n) = ∑ ∑ pm (r ) x[ n − ( rM + m)]
m = 0 r = −∞
let xm (r ) = x(rM + m)
M −1 ∞
y ( n) = ∑ ∑ p m ( r ) x m ( n − r )
m = 0 r = −∞
M −1
y ( n) = ∑ p m ( n) * x m ( n )
m=0
M −1
y ( n) = ∑ y m ( n )
m =0
The operation pm (n) * xm (n) is known as polyphase convolution, and the overall process is
polyphase filtering. xm(n) is obtained first delaying x(n) by M units then downsampling by a factor M. Next
ym(n) can be obtained by convolving xm(n) with pm(n).
x1(n)
↓M P1(n) +
Z-1
x2(n)
↓M P2(n)
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
x1(n)
↓M P1(n) +
Z-1
x2(n)
↓M P2(n) +
xM-1(n)
↓M PM-1(n)
The splitting of x(n) into the low rate sub sequence x0(n),x1(n)……..xM-1(n) is often
represented by a commutator. The input values x(n) enter the delay chain at high rate. Then the M
downsampler sends the group of M input values to M filters at time n=mM.
x0(n) y(n)
P0(n) + Rate Fy = Fx/M
m=0
x1(n)
Rate Fx m=1
P1(n) +
x(n)
m=2
x2(n)
P2(n) +
m = M-1
xM-1(n)
PM-1(n)
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
To produce the output y(0), the commutator must rotate in counter-clockwise direction
starting from m = M-1…… m=2, m=1, m=0 and give the input values x(-M+1)…..x(-2), x(-1), x(0) to
the filters pM-1(n)…….p2(n),p1(n),p0(n).
By transposing the decimator structure, we can obtain the polyphase structure for
interpolator, which consists of a set of L sub filters connected in parallel.
y1(n)
P1(n) ↑L +
Z-1
y2(n)
P2(n) ↑L +
Z-1
yM-1(n)
PM-1(n) ↑L
Where h(n) is the impulse response of anti-imaging filter. The output of L sub filters can be
represented as
y m ( n) = x ( n ) p m ( n ) m = 0,1,2........L − 1
By upsampling with a factor L and adding a delay z-m the polyphase components are
produced from ym(n). These polyphase components are all added together to produce the output
signal y(n)
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
The output y(n) also can be obtained by combining the signals xm(n) using a commutator as
shown below
x(n) y0(n)
P0(n)
m=0
y1(n)
P1(n)
m=1
y(n)
m=2
y2(n)
P2(n)
m = M-1
yL-1(n)
PL-1(n)
If the decimation factor M and/or interpolation factor L are much larger than unity, the
implementation of sampling rate conversion in a single stage is computationally inefficient.
Therefore for performing sampling rate conversion for either M>>1 and/or L>>1 the multistage
implementation is preferred.
If the interpolation factor L>>1, then express L into a product of positive integers as
N
L = ∏ Li
i =1
Then each interpolator Li is implemented and cascaded to get N stages of interpolation and
filtering.
Similarly if the decimation factor M>>1 then express M into a product of positive integers as
N
M = ∏Mi
i =1
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
Each decimator Mi is implemented and cascaded to get N stages of filtering and decimators.
Fx/M1
x(n) Fx/M1M2 y(n)
h1(n) ↓M1 h2(n) ↓M2 hN(n) ↓MN
Fx Fy=Fx/M
x(n) F/M
LPF LPF y(n)
↓M ↑M
F h1(n) h2(n) F
In the above diagram, the interpolator and decimator are in cascade. The filters h1(n) and
h2(n) in the decimator and interpolator are lowpass filters. The sampling frequency of the input
sequence is first reduced by a factor M then lowpass filtering is performed. Finally the original
sampling frequency of the filtered data is obtained using interpolator.
To meet the desired specifications of a narrow band LPF, the filters h1(n) and h2(n) are
identical, with passband ripple δp/2 and stopband ripple δs.
Filter bank:
• Analysis filter bank
• Synthesis filter bank
H1(z) ↓M U1(z)
H2(z) ↓M U2(z)
HM-1(z) ↓M UM-1(z)
Fatima Michael College of Engineering & Technology
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
+
∧
U0(z) ↑M G0(z) X (z )
U1(z) ↑M G1(z) +
U2(z) ↑M G2(z) +
UM-1(z) ↑M GM-1(z)
The M channel synthesis filter bank is dual of M channel analysis filter bank. In this case
Um(z) is fed to an upsampler. The upsampling process produces the signal Um(zM). These signals are
∧
applied to filters Gm(z) and finally added to get the output signal X (z ) . The filters G0(z) to
GM-1(z) have the same characteristics as the analysis filters H0(z) to HM-1(z).
If we combine the analysis filter band and synthesis filter band we obtain an M-channel
subband coding filter bank.
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
X(z) ∧
H0(z) ↓M ↑M G0(z) + X (z )
H1(z) ↓M ↑M G1(z) +
H2(z) ↓M ↑M G2(z) +
HM-1(z) ↓M ↑M GM-1(z)
The analysis filter band splits the broadband input signal x(n) into M non-overlapping
frequency band signals X0(z), X1(z)……XM-1(z) of equal bandwidth. These outputs are coded and
∧
transmitted. The synthesis filter bank is used to reconstruct output signal X (z ) which should
approximate the original signal. It has application in speech signal processing.
V0(z) U0(z) V0 ( z )
H0(z) ↓2 ↑2 G0(z)
Y(z)
X(z)
∧
+
V1(z) U1(z) V1 ( z )
H1(z) ↓2 ↑2 G1(z)
1. Analysis section
2. Synthesis section
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
Analysis Section:
|H0(ejω)| |H1(ejω)|
1.0
0 π/2 π ω
The output of low pass and high pass filters are
V0 ( z ) = X ( Z ) H 0 ( z ) and
……………1
V1 ( z ) = X ( Z ) H 1 ( z )
Down sampling with M = 2, yields the subband signals
1 1
1
U 0 ( z ) = [V0 ( z 2 ) + V0 (− z 2 ) and
2
1 1
…………….2
1
U 1 ( z ) = [V1 ( z 2 ) + V1 (− z 2 )
2
Substitute equation 1 in equation 2
1 1 1 1
1
U 0 ( z ) = [ X ( z 2 ) H 0 ( z 2 ) + X (− z 2 ) H 0 (− z 2 ) and
2
1 1 1 1
1
U 1( z ) = [ X ( z 2 ) H 1 ( z 2 ) + X (− z 2 ) H 1 (− z 2 )
2
In matrix form
1 1
1
U 0 ( z ) 1 H 0 ( z 2 ) H 0 ( − z 2 ) X ( z 2 )
=
U 1( z ) 2 1 ……………….3
1
1
H 1 ( z ) H 1 ( − z ) X ( − z )
2 2 2
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
H0(z) H1(z)
Lowpass Highpass
ω
π/2 π
V0(z)
ω
π/2 π
U0(z)
ω
π/2 π
V1(z)
ω
π/2 π
U1(z)
ω
π/2 π
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
x(n) is a white noise input signal. The frequency spectra of V0(z) have two components one
is the original spectrum that depends on X(z1/2) lies in the baseband and the other is periodic
repetition that is function of X(z-1/2). The high pass signal U1(z) drops into the baseband 0 ≤ ω ≤ π
and is reversed in frequency. Since the filtered signals are not properly band limited to π, alias
signals appear in baseband.
Synthesis section:
The signals U0(z) and U1(z) are fed to the synthesis filter bank. Here the signals U0(z) and
U1(z) are upsampled and then passed through two filters G0(z) and G1(z) respectively. The filter
G0(z) is a lowpass filter and eliminates the image spectrum of U0(z) in the range π/2 ≤ ω ≤ π.
Meanwhile the highpass filter G1(z) eliminates most of the image spectra in the range 0 ≤ ω ≤ π/2.
As the frequency range of the two signals U0(z) and U1(z) overlap, the image spectra is not
completely eliminated.
Y ( z ) = G0 ( z )U 0 ( z 2 ) + G1 ( z )U 1 ( z 2 ) ……………….4
∧
V0 ( z ) = U 0 ( z 2 )
Where
∧
V1 ( z ) = U 1 ( z 2 )
U ( z 2 )
Y ( z ) = [G0 ( z ) G1 ( z )] 0
U ( z 2 )
1
From equation 3
U 0 ( z 2 ) 1 H 0 ( z ) H 0 (− z ) X ( z )
2
=
U 1( z ) 2 H 1 ( z ) H 1 (− z ) X (− z )
1 H ( z ) H 0 (− z ) X ( z )
Y ( z ) = [G0 ( z ) G1 ( z )] 0
2 H 1 ( z ) H 1 ( − z ) X ( − z )
1 1
Y ( z ) = [G0 ( z ) H 0 ( z ) + G1 ( z ) H 1 ( z )] X ( z ) + [G0 ( z ) H 0 ( − z ) + G1 ( z ) H 1 ( − z )] X ( − z )
2 2
Y ( z ) = T ( z ) X ( z ) + A( z ) X (− z ) …………5
www.studentsfocus.com
Fatima Michael College of Engineering & Technology
Where
1
T ( z) = [G0 ( z ) H 0 ( z ) + G1 ( z ) H 1 ( z )]
2
1
A( z ) = [G0 ( z ) H 0 ( − z ) + G1 ( z ) H 1 ( − z )]
2
The function T(z) describes the transfer function of the filter and is called distortion transfer
function. The function A(z) is due to aliasing components.
To obtain an alias free filter bank, we can choose the synthesis filter such that A(z) = 0.
1
i.e., A( z ) = [G0 ( z ) H 0 ( − z ) + G1 ( z ) H 1 ( − z )] = 0
2
G0 ( z ) H 0 (− z ) + G1 ( z ) H 1 (− z ) = 0
Substituting z = e jω yields
Y (e jω ) = T (e jω ) X (e jω )
=| T (e jω ) | e jθ (ω ) X (e jω )
If | T (e jω ) | is constant for all ‘ω’, there is no amplitude distortion. This condition is satisfied when
T (e jω ) is an all pass filter. In same way, if T (e jω ) have linear phase there is no phase distortion. This
condition is satisfied when θ (ω ) = αω + β for constant α and β. Therefore T (e jω ) need to be a linear
phase all pass filter to avoid any magnitude or phase distortion.
If an alias free QMF bank has no amplitude and phase distortion then it is called a perfect
reconstruction (PR) QMF bank. In such a case
i.e., the reconstructed output of a PRQMF bank is a scaled, delayed replica of the output.
www.studentsfocus.com