You are on page 1of 135

Fatima Michael College of Engineering & Technology

UNIT - I
DISCRETE FOURIER TRANSFORMS (DFT)

1. DIRECT COMPUTATION

2. RADIX-2 FFT

3. DECIMATION-IN-TIME FFT

4. FLOWGRAPHS

5. BIT REVERSAL PERMUTATION

6. COMPLEXITY

7. DECIMATION-IN-FREQUENCY FFT

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology
THE FFT

A fast Fourier transform (FFT) is any fast algorithm for computing


the DFT. The development of FFT algorithms had a tremendous
impact on computational aspects of signal processing and applied
science. The DFT of an N -point signal

{x[n], 0  n  N 1}

is defined as
N
X1
X[k] = x[n] WN kn , 0kN 1
n=0

where ✓ ◆ ✓ ◆
j 2⇡ 2⇡ 2⇡
WN = e = cos N + j sin
N N
is the principal N -th root of unity.

DIRECT DFT COMPUTATION

Direct computation of X[k] for 0  k  N 1 requires

(N 1)2 complex multiplications

N (N 1) complex additions

Fatima Michael College of Engineering & Technology

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

The development of the FFT will call on two properties of WN .


The first property is:
WN2 = WN/2

which is derived as

j 2⇡
N ·2
WN2 = e
2⇡
j N/2
=e
= WN/2 .

More generally, we have

WN2nk = WN/2
nk
.

The second property is:


k+ N2
WN = WNk

Fatima Michael College of Engineering & Technology

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

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology
DECIMATION-IN-TIME FFT

Consider an N -point signal x[n] of even length. The derivation of


the DIT radix-2 FFT begins by splitting the sum into two parts
— one part for the even-indexed values x[2n] and one part for the
odd-indexed values x[2n + 1]. Define two N/2-point signals x1 [n]
and x2 [n] as

x0 [n] = x[2n]
x1 [n] = x[2n + 1]

for 0  n  N/2 1. The DFT of the N -point signal x[n] can be


written as
N
X1 N
X1
nk
X[k] = x[n] WN + x[n] WN nk
n=0 n=0
n even n odd

which can be written as


N/2 1 N/2 1
X X (2n+1)k
2nk
X[k] = x[2n] WN + x[2n + 1] WN
n=0 n=0
N/2 1 N/2 1
X X (2n+1)k
= x0 [n] WN 2nk + x1 [n] WN
n=0 n=0
N/2 1 N/2 1
X X
2nk k
= x0 [n] WN + WN · x1 [n] WN 2nk
n=0 n=0
N/2 1 N/2 1
X X
nk
= x0 [n] WN/2 + WN k · nk
x1 [n] WN/2
n=0 n=0

N
where we used the first identity above. Recognizing that the 2 -pont

Fatima Michael College of Engineering & Technology

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

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology
DIT FFT (2)

we obtain the equation

X[k] = X0 [k] + WN k · X1 [k].

The signal x0 [n] is an N/2-point signal, so its DFT is also an N/2-


point signal. When k is taken outside the range 0  k  N/2 1
the DFT coefficients are periodic with a period of N/2:

X0 [k] = X0 [hkiN/2 ] or X0 [k] = X0 [k + N/2],

and likewise for X1 [k]

X1 [k] = X1 [hkiN/2 ] or X1 [k] = X1 [k + N/2].

For example, if N = 8, then

X[0] = X0 [0] + 1 · X1 [0]


X[1] = X0 [1] + W8 1 · X1 [1]
X[2] = X0 [2] + W8 2 · X1 [2]
X[3] = X0 [3] + W8 3 · X1 [3]
X[4] = X0 [0] + W8 4 · X1 [0]
X[5] = X0 [1] + W8 5 · X1 [1]
X[6] = X0 [2] + W8 6 · X1 [2]
X[7] = X0 [3] + W8 7 · X1 [3].

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology
k+ N2
Using WN = WNk derived earlier, we obtain for this example

X[0] = X0 [0] + 1 · X1 [0]


X[1] = X0 [1] + W8 1 · X1 [1]
X[2] = X0 [2] + W8 2 · X1 [2]
X[3] = X0 [3] + W8 3 · X1 [3]
X[4] = X0 [0] 1 · X1 [0]
X[5] = X0 [1] W8 1 · X1 [1]
X[6] = X0 [2] W8 2 · X1 [2]
X[7] = X0 [3] W8 3 · X1 [3].

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology
DIT FFT (3)

With this modification, the DFT coefficients X2 [k] need only be


k
multiplied by W8 for 1  k  N/2 1, incurring N/2 1
multiplications.
In general, one has
N
X[k] = X0 [k] + WN k · X1 [k] for 0  k  1 (1)
2
N N
X[k + ] = X0 [k] WN k · X1 [k] for 0  k  1 (2)
2 2
The multipliers WNk are known as twiddle factors.
The Matlab code fragment illustrates this relation for N = 8:

>> x = [82 44 62 79 92 74 18 41]’;


>>
>> % "decimate" x(n) in time:
>> x0 = x(1:2:8);
>> x1 = x(2:2:8);
>>
>> % Take the half-length DFTs:
>> X0 = fft(x0);
>> X1 = fft(x1);
>>
>> % define constants
>> i = sqrt(-1);
>> N = 8;
>> W = exp(2*pi/N*i);
>> k = [0:N/2-1]’;
>>

Fatima Michael College of Engineering & Technology

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

>> % verify that this gives the DFT of x(n):


>> fft(x)

ans =

492
-58.083 - 49.657i

Fatima Michael College of Engineering & Technology

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

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology
FLOWGRAPHS

If N/2 can be further divided by 2, then this same procedure can


be used to calculated the N/2-point DFTs. It is useful to illustrate
the radix-2 FFT algorithm with a flowgraph, as developed here.

The expression above shows how an N -point DFT can be computed


using two N/2-point DFTs. After taking the two N/2-point DFTs
it only remains to multiply the result of the second DFT with the
terms WNk and to combine the results by adding and subtracting.

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

The decimation-in-time FFT for an 8-point DFT consists of

1. 2 4-point DFT computations,

2. the twiddle factors,

3. butterflies

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology
FLOWGRAPHS (2)

We order the input so the even-indexed terms come first.

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]

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology
FULL FLOWGRAPH

The 2-point DFT is simply a butterfly (sum/di↵erence), so the final


FFT has 3 stages.
x[0] X[0]

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

1. This FFT algorithm can be implemented in-place.

2. The number of stages is log2 N . Because each stages has


a complexity of order N , the overall complexity is of order
N log2 N .

3. In the DIT flowgraph the signal x(n) is bit-reversed.

Fatima Michael College of Engineering & Technology

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.

Before the in-place implementation of the DIT FFT algorithm can


be done, it is necessarily to first shu✏e the the sequence x(n)
according to this permutation.

The required permutation corresponds to reversing the binary rep-


resentation of the index.

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

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology
COMPLEXITY

To determine the arithmetic complexity of this algorithm for com-


puting the DFT, let Ac (N ) and Mc (N ) denote respectively the
number of complex additions and multiplications for computing the
DFT of an N -point complex sequence x[n]. Let N be a power of
2, N = 2K . Then, according to the procedure above, one has

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:

X[0] = x[0] + x[1]


X[1] = x[0] x[1].

Hence, the starting conditions are Ac (2) = 2 and Mc (2) = 0. Then


solving the recursive equation yields

Ac (N ) = N log2 N complex additions.

Similarly, one has a formula for complex multiplications:


N
Mc (N ) = log2 N N +1 complex multiplications.
2
A single complex multiplication can be performed with 4 real mul-
tiplications and 2 real additions. A single complex addition can be
performed with 2 real additions. Therefore,

Mr (N ) = 4 · Mc (N )
Ar (N ) = 2 · Mc (N ) + 2 · Ac (N )

Fatima Michael College of Engineering & Technology

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

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology
COMPLEXITY (2)

In fact, this number can be reduced by a more careful examination of


the multipliers WNk (the twiddle factors). In particular, the numbers
1, -1, j, and j will be among the twiddle factors WNk , when k
is a multiple of N/4 — and so those multiplications need not be
performed. Taking this into account one can reduce the number of
multiplications a bit more.

The advantage of the efficient algorithm for computing the DFT is a


reduction from an arithmetic complexity of N 2 for direct calculation
to a complexity of N log2 N . This is a fundamental improvement
in the complexity, and historically it led to many new developments
in signal processing that would not have otherwise been possible or
practical. Due to its fundamental speed-up in calculating the DFT,
the efficient algorithm for its computation is called the Fast Fourier
Transform or FFT.

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology
DECIMATION-IN-FREQUENCY FFT

Consider an N -point signal x[n] of even length. The derivation of


the DIF radix-2 FFT begins by splitting the DFT coefficients X[k]
in to even- and odd- indexed values. The even values X[2k] are
given by:
N
X1
X[2k] = x[n] WN 2kn
n=0
N
X1
kn
= x[n] WN/2 .
n=0

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].

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology
DIF FFT (2)

Similarly, the odd values X[2k + 1] are given by:


N
X1 (2k+1)n
X[2k + 1] = x[n] WN
n=0
N
X1
= x[n] WN n WN 2kn
n=0
N
X1
= x[n] WN n WN/2
kn
.
n=0

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]).

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology
DIF FLOWGRAPHS

The DIF radix-2 FFT algorithm is illustrated by the

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]

Fatima Michael College of Engineering & Technology

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.

2. Both can be implemented in-place.

3. For the DIT FFT, x[n] is in bit-reversed order, X[k] is in


normal order. For the DIF FFT, X[k] is in bit-reversed order,
x[n] is in normal order.

The DIT FFT algorithm requires a bit-reversal prior to the in-place


flowgraph, while the DIF FFT algorithm requires a bit-reversal after
the in-place flowgraph.

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology
Other FFT algorithms

Other FFT algorithms include the Cooley-Tukey FFT which can be


used whenever the length of the data vector can be factored as
N = N1 · N 2 .

In addition, there is a class of FFT algorithms that apply only when


the factors N1 and N2 are relatively prime (when their greatest
common divisor is 1). Those algorithms, called Prime Factor FFTs,
avoid the multiplications by twiddle factors. They require fewer
multiplications, but are more complicated to program.

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology
Operation Counts of the MATLAB fft Command

With early versions of MATLAB, we could measure the number


of flops (floating point operations) of many MATLAB commands.
(That ability is no longer available in current versions of MATLAB).
Using an earlier version of MATLAB, we measured the flops used
by the fft command for lengths 2  N  512. We made a plot of
the number of flops versus the length N using plot(n,f,’.’) to
prevent MATLAB from connecting the dots. The result is shown
below:

6 Flops
x 10
2.5

1.5

0.5

0
0 50 100 150 200 250 300 350 400 450 500
N

Fatima Michael College of Engineering & Technology

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

The graphs show the number of floating point operations (flops)


incurred by the MATLAB fft command. This graph was done with
version 5.2 of MATLAB. Version 6 will give di↵erent flop counts
(improved flops counts for some values of N ).
1. The lengths for which the fft command is slowest are the
prime lengths. For these lengths, the fft command simply
computes the DFT directly using no fast algorithm. For the
direct computation of the DFT, we know the flops are propor-
tional to N 2 , and that is evident in the graph.

2. The second top line corresponds to lengths that are N =


2 · prime. For these lengths the fft command decomposes

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology
the DFT into two DFTs each of length N/2. Likewise for
other composite lengths.

3. For powers of 2, the implementation of the fft command


can use a pure radix-2 FFT algorithm, which is carefully pro-
grammed for maximum efficiency. The fft command is sig-
nificantly more efficient for powers of 2 than for other lengths.

The following MATLAB code was used for this problem.


f = zeros(1,512);
for n = 1:512
x = rand(1,n);
flops(0);
X = fft(x);
f(n) = flops;
end

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

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology
UNIT - II
Design of IIR Filters

• A digital filter, H ( e ) , with infinite impulse response (IIR), can be


designed by first transforming it into a prototype analog filter Hc ( jΩ ) and


then design this analog filter using a standard procedure. Once the analog
filter is properly designed, it is then mapped back to the discrete-time
domain to obtain a digital filter that meets the specifications.

The commonly used analog filters are

1. Butterworth filters – no ripples at all,


2. Chebychev filters - ripples in the passband OR in the stopband, and
3. Elliptical filters - ripples in BOTH the pass and stop bands.

The design of these filters are well documented in the literature.

A disadvantage of IIR filters is that they usually have nonlinear phase.


Some minor signal distortion is a result.

• There are two main techniques used to design IIR filters:

1. The Impulse Invariant method, and


2. The Bilinear transformation method.

Fatima Michael College of Engineering & Technology

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 )

• From our discussion in Chapter 2,


 ω 2π k 
H (e jω
)= ∑ c T
H j + j 
k =−∞  d Td 

and aliasing would occur if H c ( jΩ ) is not bandlimited to π / Td (in rad/s).

If H c ( jΩ ) is bandlimited to π / Td , then

H ( e jω ) = H c ( jω / Td ) .

In this case, it is straight forward to specify the prototype analog filter.

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 π

Digital filter specifications

H c ( jΩ )

1
1− δ1

δ2

ωp ωs π
Td Td Td

Prototype analog filter


Fatima Michael College of Engineering & Technology

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Ω

is the Laplace domain variable. Assuming H c ( s) has only single-order


poles sk , then
N
Ak
H c (s ) = ∑
k =1 s − s k
This implies

∑ 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

Fatima Michael College of Engineering & Technology

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.

• It should be emphasized that

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π ≤ ω ≤ π

Use the impulse invariant technique and an analog Butterworth filter.


Assume Td = 1 and that there is minimal aliasing.

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology
Solution

- with Td = 1 , this means Ω = ω , and H c ( jΩ) = H ( e jΩ ) . Consequently, the


specifications of the analog prototype filter are

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.

- The magnitude square response of a Butterword filter of order N is

2 1
H c ( j Ω) = 2N
1+ ( )

Ωc

where Ωc is the 3-dB frequency of the filter. It is observed that the


magnitude square response decreases monotonically with frequency.
The larger N is, the closer the Butterworth filter is to an ideal low pass
filter.

The term H a ( jΩ) in this figure is the same as our H c ( jΩ )

Fatima Michael College of Engineering & Technology

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 exact results are N = 5.8858 and Ωc = .70474 . After rounding, we


have N = 6 and Ωc = .7032 . This latter set of results means the passband
requirement is met exactly at ω p = 0.2π and met with margin at
ω s = 0.3π . Specifically, H c ( j0.3π ) = 0.1700 < 0.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.

Fatima Michael College of Engineering & Technology

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

The poles of the corresponding digital filter are

0.649 ± 0.524 j
0.535 ± 0.290 j
0.499 ± 0.092 j

- The transfer function of the Butterworth filter is

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

where the Ak s are the partial fraction expansion coefficients.

Fatima Michael College of Engineering & Technology

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

0.2871 − 0.4466 z −1 −2.1428 + 1.1455 z −1


= +
1 − 1.2971z −1 + 0.6949z −2 1 − 1.0691z −1 + 0.3699 z −2
1.8557 − 0.6303 z −1
+
1 − 0.9972 z −1 + 0.2570 z −2

Fatima Michael College of Engineering & Technology

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

Then issue the Matlab command

[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 .

The poles of the corresponding Butterworth filter can be obtained by


issuing the Matlab command

[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

which are slightly different from those in the text.

Finally use the matlab command ‘impinvar” to convert the analog


prototype filter into a corresponding digital filter.

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology
• Example: Repeat the last example using a Chebyshev filter.

- The magnitude square response of a N-th order Chebyshev filter with a


ripple parameter of ε is

2 1
H c ( jΩ) =
1 + ε 2VN2 ( ),

Ωc

where VN ( x ) is the N-th order Chebysheve polynomial, defined as

(
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)

- It is observed that when x is between 0 and unity, VN ( x) varies between


0 and unity. However, when x is greater than 1, cos −1 x is imaginary
and so VN ( x) behaves like a hyperbolic cosine and consequently
increases monotonically for x greater than unity. Consequently, the
magnitude response of a Chebyshev filter looks like the following
(correction: replace 1 − ε by 1/ 1 + ε 2 )

Fatima Michael College of Engineering & Technology

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

Consequently the filter order is N=4.

- 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 .

The equation of this ellipse is given by

σ2 Ω2
2 2
+ 2 2 =1
a Ωc b Ωc

Fatima Michael College of Engineering & Technology

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.

An example for finding the poles of a Chebyshev filter with 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

Fatima Michael College of Engineering & Technology

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

and then issue the Matlab command

[N,Wn]=cheb1ord(Wp,Ws,Rp,Rs,'s')

Finally complete the filter design by issuing the command

[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.

- The transfer function of the corresponding digital IIR filter is

0.08327 + 0.0239 z −1 0.08327 − 0.0246 z −1


H ( z) = +
1 − 1.5658 z −1 + 0.6549 z −2 1 − 1.4934 z −1 + 0.8392 z −2

- 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.

• Aliasing occurs because points in the Ω axis separated by 2π / Td are


mapped into the same digital frequency ω . In the Bilinear transformation
method, there is a one-to-one correspondence between Ω and ω . So
aliasing is avoided in transforming the prototype analog filter back into the
digital filter.

Since ω is limited to [ −π , π ] but Ω varies from −∞ to +∞ , it becomes clear


that Ω must be compressed when it is mapped to ω . In other word,
Bilinear transformation is non-linear in nature.

• 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

into the expression of H c (s ) . In other word

 2 1 − z −1 
H ( z) = H c  −1 
T
 d 1 + z 

Fatima Michael College of Engineering & Technology

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

• If s = σ + jΩ , where Ω is the analog frequency, then

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

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology
θ = arctan  ( ) ( 1+ ) + arctan ( ) (1− )
ΩTd
2
σ Td
2
ΩTd
2
σ Td
2

are respectively the magnitude and phase of z .

Observations:

1. When σ < 0 , z < 1 . So left-plane poles of H c (s ) will be mapped into


poles within the unit circle in the z-plane. In other word, a stable
prototype analog filter will lead to a stable digital filter.

2. When σ = 0 , z = 1 . In other word, z lies on the unit circle and can be


written as
z = e jω (when σ =0)
where
 ΩT 
ω ≡ θ = 2arctan  d 
 2 

represents the digital frequency. Alternatively, we can express the


analaog frequency Ω in terms of the digital frequency ω as

2 ω 
Ω= tan  
Td 2

The figure below illustrates the relationship between Ω and ω . It is


clear that compression occurs in the mapping process.

These results indicate that the entire left-half s-plane is mapped into a
disc of radius 1 in the z-plane.

Fatima Michael College of Engineering & Technology

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π ≤ ω ≤ π

using the Bilinear transformation method and a Butterworth prototype


filter. Compare the results with those obtained through the impulse
invariant method.

Solution:

For simplicity, set Td = 1 . So Ω = 2tan (ω / 2) . This means the digital


passband and stopband frequencies,
Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology
ω p = 0.2π , ω s = 0.3π

are mapped into the analog passband and stopband frequencies

Ω p = 2tan ( ω p / 2 ) = 0.64984,
Ωs = 2tan (ω s / 2) = 1.0191

The specifications of the prototype analog filter become

0.89125 ≤ H c ( jΩ ) ≤ 1, 0 ≤ Ω ≤ 0.64984
Hc ( jΩ ) ≤ 0.17783, 1.0191 ≤ Ω ≤ ∞

Next we define the following Matlab variables

Rp=20log10(0.89125)=-1
Rs=20log10(0.17783)=-15
Wp=0.64984
Ws=1.0191

and issue the command [N,Wn]=buttord(Wp,Ws,Rp,Rs,’s’). Matlab will


return the order of the Butterworth filter in the variable N and the 3-db
frequency in the variable Wn. It was found that

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

Fatima Michael College of Engineering & Technology

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 

This can be done by using the Matlab command

[Zd,Pd,Kd]=bilinear(Z,P,K,1)

where Z, P, and K are same as before, 1 corresponds to the sampling


frequency 1/ Td , Zd is an array containing the zeros of H ( z ) , Pd is the array

Fatima Michael College of Engineering & Technology

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.

Fatima Michael College of Engineering & Technology

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?

Frequency responses of lowpass, 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.

The transfer function of the desired frequency selective filter is denoted by


H (z) .

We want to find a relationship between p and z, denoted by

( )
p −1 = G z −1
such that
H ( z ) = H lp ( p )
( )
p −1 = G z −1

It should be emphasized that the transformation relates p−1 to z −1 , not p to


z. This is due to the fact that H lp ( p ) is usually expressed as a function in
p−1 instead of p.

• We want a stable, rational H lp ( p ) be mapped into a stable rational H ( z ) .


Consequently, the requirements on the mapping function p−1 = G ( z −1 ) are:

1. G ( z −1 ) must be a rational function of z −1 .


2. The inside of the unit circle in the p-plane is mapped into the inside of
the unit circle in the z-plane.

Fatima Michael College of Engineering & Technology

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

By choosing appropiate values for N and the α k ’s, a variety of mappings


can be obtained.

• Low-pass to Low-pass transformation:

z −1 − α
−1
p =
1 − α z −1

This means the relationship between θ and ω is

− jθ e − jω − α
e =
1 − α e − jω

Fatima Michael College of Engineering & Technology

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

For a given pair of θ p and ω p , the parameter α is

sin  (θ p − ω p ) / 2
α=
sin (θ p + ω p ) / 2

It can be shown that the absolute value of α is less than 1.


Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology
• Transformations from LP to LP, HP, BP, and BS filters are shown below:

The corresponding definitions of filter cutoff frequencies are shown in the


next page.

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology

(a) low pass, (b) high pass, (c) bandpass, (d) bandstop.

Fatima Michael College of Engineering & Technology

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,

Fatima Michael College of Engineering & Technology

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.

Implementation Structures for IIR Filters

• The transfer function of an IIR filter can always be expressed as a ratio of


two polynomials, i.e.

B (z )
H ( z) = ,
A (z )

where A( z) and B( z) are respectively polynomials of orders N and M


in z −1 .

It is the denominator polynomial that makes the impulse response of the


filter infinitely long.
Fatima Michael College of Engineering & Technology

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

which is simply a linear constant coefficient different equation.

A a possible computational structure for y[n ] is shown in the signal flow


graph in the next page. There, a branch with a transmittance of z −1 is
equivalent to a delay of 1 sample, and a branch with a transmittance ai (or
b j ) implies a scaling of the signal at the originating node of that branch by
the constant ai (or b j ). As in any signal flow graph, the signal at any node,
i.e. the node value, is the sum of products of the signal at an originating
node and the corresponding branch transmittance.

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology

The above computational structure is called the Direct Form I


implementation of an IIR filter. Note that for simplicity, we assume that
the order of the numerator and denominator polynomials are identical, i.e.
N=M .

It is observed that the Direct Form I implementation structure requires


2 N + 1 multiplications, 2N additions, and 2N delay elements.

• The number of delay elements can be reduced to N if we interchange the


two sections in the Direct Form I structure. This leads us to the Direct
Form II structure shown below.

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology

• It is also possible to express the transfer function of an IIR filter in product


form as

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).

Note that the products (1 − g z )(1 − g


k
−1 *
k z −1 ) and (1 − d z )(1 − d z )
k
−1 * −1
k are 2nd
order polynomials in z −1 with real coefficients.
Fatima Michael College of Engineering & Technology

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.

Fatima Michael College of Engineering & Technology

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.

• If we express the transfer function as a partial fraction expansion, then

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

and all the polynomial coefficients are real.

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.

Fatima Michael College of Engineering & Technology

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.

• Exercise: While it is straight forward to incorporate any given initial


condition of an IIR filter in the Direct Form I structure, it is not clear how
this can be done in the other structures. Is this a matter of great concern? If
so, suggest how a given initial condition can be incorporated into the Direct
Form II, the Cascade form, and the Parallel form.

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology

UNIT- III
www.studentsfocus.com

Design of FIR Filters

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

Frequency Response of Digital Filters


• Frequency response of digital Filter: H(eȷθ ) = |H(eȷθ )|e−ȷφ(θ)
– continuous function of θ with period 2π ⇒ H(eȷθ ) = H[eȷ(θ+m2π)]

• |H(eȷθ )| is the called the Magnitude function.


www.studentsfocus.com

→ Magnitude functions are even functions ⇒ |H(eȷθ )| = |H(e−ȷθ )|

• φ(θ) is called the Phase (lag) angle, φ(θ) ! ∠H(eȷθ ).


→ Phase functions are odd functions ⇒ φ(θ) = −φ(−θ)
• More convenient to use the magnitude squared and group delay
functions than |H(eȷθ )| and φ(θ).
ȷθ 2
!
−1 !
– Magnitude squared function: |H(e )| = H(z)H(z ) ȷθz=e
– It is assumed that H(z) has real coefficients only.
– Group delay function τ (θ) = dφ(θ)
dθ . Measure of the delay of the filter
response.

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

Digital Filter Frequency Response: Poles & Zeros

ℑ{z}
• Complex zeros zk and poles pk Occurs in quadruples
z−plane
occur in conjugate pairs. Occurs in conjugate pairs
www.studentsfocus.com

with even multiplicity

Occurs with even multiplicity


2
• If zk = a is a real zero/pole Occurs in pairs

of |H(eȷθ )|2 ⇒ zk−1 = a−1 is


also a real zero/pole.
ℜ{z}
2
• If zk = rk eȷθ is a −2

zero/pole of |H(eȷθ )|2 ⇒


rk e−ȷθ , ( r1 )eȷθ and ( r1 )e−ȷθ
k k
are also zeros/poles. −2

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

Digital Filters: Transfer Functions


• The problem of finding the transfer function of a filter is the problem of
universal function approximation. This is usually solved by involving
some basis functions (Fourier, Chebyshev, ...). In our case, the basis
functions will be polynomials or rational functions in z (or z −1.
www.studentsfocus.com

• Finite Impulse Response (FIR) filter: Digital filter characterised by


transfer functions in the form of a polynomial
H(z) = a0 + a1z −1 + · · · + zmz −M

• Infinite Impulse Response (IIR) filter: characterised by transfer


functions in the form of a rational function
M
P
ai z −i
i=0 A(z −1)
H(z) = PN
= B(z −1 )
bj z −j
j=0

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

Digital Filters: Transfer Functions Properties


• FIR filters are stable and causal.

• IIR filters are:


– Stable if all the poles of H(z) are within the unit circle
www.studentsfocus.com

– Causal if bL is the first non-zero coefficient in the denominator (i.e.


b0 = b1 = · · · = bL−1 = 0 and a0 = a1 = · · · = aL−1 = 0 .

• 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

• We would ideally like to design filters with linear phase in the


passband - what about the phase in the stopband?

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

Digital Filters: Magnitude and Phase Characteristics


|H(eȷθ )| |H(eȷθ )|
Low−pass Filter Band−reject Filter

-2π -π π 2π θ rad -2π -π π 2π θ rad


www.studentsfocus.com

|H(eȷθ )| |H(eȷθ )|
Band−pass Filter All−pass Filter

-2π -π π 2π θ rad -2π -π π 2π θ rad

|H(eȷθ )| φ(θ)
High−pass Filter Phase Characteristics

θ rad

-2π -π π 2π θ rad -2π -π π 2π 3π

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

Design of All-pass Digital Filters


• An all-pass filter is an IIR filter with a constant magnitude function for
all digital frequency values.
• For a transfer function H(z) to represent an all-pass filter is that for
every pole pk = rk ejθ , there is a corresponding zero zk = r1 ejθ . The
www.studentsfocus.com

k
poles and zeros will occur in conjugate pairs if θk ̸= 0 or π.

• A digital filter H(z) obtained by cascade connection of multiple all-pass


filters H1(z), H2(z) · · · HN (z) sections is itself an all-pass filter, and can
be represented by
H(z) = H1(z)H2(z) · · · HN (z)

◦ So why do we need all-pass filters? They are phase-selective (as


opposed to frequency selective) and are extremely useful in the
design of DSP systems.

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

First order All-pass Digital Filter


• A typical first-order section of an all-pass digital filter has a transfer
function
z −1 − a
H1(z) = (1)
1 − az −1
where a is real and to be stable, we must have |a| < 1.
www.studentsfocus.com

Im[z]

Unit Circle

Re[z]
a 1/a

Figure 1: Pole-zero pattern of first order all-pass digital filter.

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

First- and Second-Order All-pass Digital Filter

◦ The magnitude function is unity for all frequencies, as given by


! 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

◦ A typical second-order section of an all-pass digital filter

1 − ( r2 ) cos θk z −1 + ( r12 )z −2 [1 − ( r1 )z −1ejθ ][1 − ( r1 )z −1e−jθ ]


k k k k
H2(z) = =
1 − 2rk cos θz −1 + rk2 z −2 [1 − rk z −1ejθ ][1 − rk z −1e−jθ ]

1 ±jθk
# The poles are at p1,2 = rk e±jθk and the zeros at z1,2 = rk e

◦ For filter to be stable, |rk | < 1.

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

First- and Second-Order All-pass Digital Filter

Im[z]
www.studentsfocus.com

Unit Circle 1

X θ 1/r
X −θ
Re[z]
r

Figure 2: Pole-zero pattern of a second order all-pass digital filter.

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

First order All-pass Digital Filter

The magnitude function is given by


www.studentsfocus.com

ejθ − ( r1 )ejθk ejθ − ( r1 )e−jθk


|H2(ejθ )|2 = | k
|2| k
|2 (2)
ejθ − rk ejθk ejθ − rk e−jθk
ejθ −( r1 )ejθk ejθ −( r1 )e−jθk
where | k
ejθ −rk ejθk
2
| =| k
ejθ −rk e−jθk
|2 = rk−2

Hence
|H2(ejθ )|2 = rk−4 = c (3)
where c is a constant, implying that it represents an all-pass filter.

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

Design of FIR Digital Filter

The transfer function of FIR digital filter is in the form of


www.studentsfocus.com

N
X −1
−n
H(z) = h(n)z (4)
n=0

where the impulse response is of length N .

The filter will have linear phase response if the FIR digital filter satisfies

h(n) = h(N − 1 − n) (5)

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

Design of FIR Digital Filter


for n = 0, 1, . . . , (N/2) − 1 if N is even, and for n = 0, 1, . . . , (N − 1)/2 if N is
odd. Indeed if N is odd, then (4) and (5) give
N
X −1
jθ −jnθ
H(e ) = h(n)e
n=0
www.studentsfocus.com

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

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

Design of FIR Digital Filter


In similar way, (4) and (5), for even values of N , give

(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 π < θ ≤ π .

The group delay function is

′ N −1
τ (θ) = φ (θ) = (10)
2
which is constant for π < θ ≤ π .

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

Constraints on zero-phase FIR filters


The zero locations of FIR filter are restricted to meet certain symmetry requirements due
to constraints imposed by (5). To see this, (4) is written as

N
X −1
−(N −1) N −n−1
H(z) = z h(n)z
www.studentsfocus.com

n=0

Let m = N − n − 1 be a new dummy variable, then (12) can be written as

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.

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

Symmetry properties of digital FIR filters

• If zi = a is a real zero of H(z), then zi−1 = a−1 is also a zero of H(z).

Im[z]
www.studentsfocus.com

Unit Circle

Re[z]
a 1/a

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

Symmetry properties of digital FIR filters

• If zi = ejθi is a zero of H(z), where θi ̸= 0 and θi ̸= π , then zi−1 = z i = e−jθi is


also a zero of H(z).
www.studentsfocus.com

Im[z]

Unit Circle

Re[z]

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

Symmetry properties of digital FIR filters

• If zi = riejθi is a zero of H(z), where ri ≠ 1, θi ̸= 0 and θi ̸= π , then


z i = ri e−jθi and zi−1 = r1 e−jθi and z −1
i = r1 ejθi are also zeros of H(z).
i i

Im[z]
www.studentsfocus.com

Unit Circle

θi
Re[z]
θi

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

Frequency sampling method

An FIR filter has equivalent DFT representation, given by

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.

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

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

Solution: In this case, the DFT sequence is given by

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

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

By using (14), the desired transfer function can be found

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.

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

The Windowing Method


• The Fourier series expansion of the frequency response of a digital filter, H(ejθ ), is
given by

X
jθ −jθn
H(e ) = h(n)e (17)
www.studentsfocus.com

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.

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

The Windowing Method

• Given the desired frequency response H(ejθ ), which may be obtained by


the frequency sampling method.
www.studentsfocus.com

• Find the associated impulse response sequence h(n) from 17 or by


inverse z-transform of H(z), where H(z) is obtained from H(ejθ ) by
replacing ejθ with z.

• Employ an appropriate window function w(n) to modify the sequence


h(n) to obtain the FIR digital filter’s impulse response sequence
hD (n) = h(n)w(n).

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

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

The Windowing Method


|H(ejθ )| |H(ejθ )|
1 1
www.studentsfocus.com

θ rad θ rad
π π

2πn
w(n) = 1 + cos for 0 ≤ n ≤ N − 1
N
= 0 otherwise (19)

Fatima Michael College of Engineering & Technology


The Windowing Method:
Fatima Michael College of Engineering & Some
Technology common window

functions

• Rectangular Window

w(n) = 1 for 0 ≤ n ≤ N − 1
= 0 otherwise (20)
www.studentsfocus.com

• Bartlett Window or Triangular Window

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.

Fatima Michael College of Engineering & Technology


The Windowing Method:
Fatima Michael College of Engineering & Some
Technology common window

functions

• Hann Window

1" 2πn #
www.studentsfocus.com

w(n) = 1 − cos for 0 ≤ n ≤ N − 1


2 N −1
= 0 elsewhere (22)

• Hamming Window

" 2πn #
w(n) = 0.54 − 0.46 cos for 0 ≤ n ≤ N − 1
N −1
= 0 elsewhere (23)

Fatima Michael College of Engineering & Technology


The Windowing Method:
Fatima Michael College of Engineering & Some
Technology common window

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.

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

Two Sinusoids in WGN:- Hamming window

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)

Expexted value of periodogram Periodogram Using Hamming window

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

The Modified Periodogram


The periodogram of a process that is windowed with a general window
w[n] is called a modified periodogram and is given by:-
! ∞ !2
1 ! )
! !
P̂M (ω) = x[n]w[n]e−ȷnω !
!
www.studentsfocus.com

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);

where, for different windows

w=hanning(N); w=bartlett(N);w=blackman(n);

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

“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;

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

Standard Window Functions:- Properties


Triangular window Hamming window
www.studentsfocus.com

Hann window Blackman window

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

Some Comments on FIR digital Filter

• Unlike IIR filters, FIR filters can be designed to have linear phase
www.studentsfocus.com

characteristics.

• FIR filters are always stable.

• 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.

Fatima Michael College of Engineering & Technology


Fatima Michael College of Engineering & Technology

UNIT - IV
FINITE WORD LENGTH EFFECTS IN DSP

Fatima Michael College of Engineering & Technology

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.

Fatima Michael College of Engineering & Technology

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.

1.1 Fixed point representation

A number in fixed point representation is exact. Arithmetic between numbers in


fixed point representation is also exact, with the conditions that (i) the answer is not
outside the range of integers that can be represented, and (ii) that division is interpreted as
producing an integer result, throwing away any integer remainder. There are many
formats to represent fixed point numbers like, Sign-magnitude, One’s compliment and
Two’s compliment, etc.

A Real number can be represented with infinite precision in two’s complement


form as

x = X m (−b0 + ∑ bi z −i )
i =1

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

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology

The resulting binary representation is quantized, so that the smallest difference


between numbers is
∆ = Xm2-B
The operation of quantizing number to (B + 1) bits can be implemented by
rounding or by truncation, but in either case quantization is a nonlinear memory less
operation. Figure 1.1 shows input - output relation for two’s complement rounding and
truncation, respectively, for the case of B = 2.

Figure 1.1 Nonlinear Relationship representing two’s complement (a) rounding and
(b) truncation for B = 2 [1]

In considering the effects of quantization, we often define quantization error as


e=QB[x] – x. For the case of two’s complement rounding, -∆/2 < e ≤ ∆/2, and for two’s
complement truncation, -∆ < e ≤ 0(Figure 1.2).

Fatima Michael College of Engineering & Technology

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”.

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology

Figure 1.3 Two’s complement rounding (a) Natural Overflow (b) Saturation. [1]

1.2 Floating point representation

In floating-point representation (IEEE 754 standard), a number is represented


internally by a sign bit s, an exact integer exponent E, and an exact positive integer
mantissa M. Taken together these represent the number

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.

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology

2. FINITE WORD LENGTH EFFECTS

Numerical quantization affects the implementation of linear time-invariant


discrete time system in several ways. Below we have given brief overview of some of
them.

• Parameter quantization in digital filters

In the realization of FIR and IIR filters hardware or in software on a general


purpose computer, the accuracy with which filter coefficients can be specified is limited
by word length of the computer. Since the coefficients used in implementing a given
filter are not exact, the poles and zeros of system function will be different from desired
poles and zeros. Consequently, we obtain a filter having a frequency response that is
different from the frequency response of the filter with unquantized coefficients. Also it
sometimes affects stability of filter.

• Round off noise in multiplication

As already explained when a signal is sampled or a calculation in the computer is


performed, the results must be placed in a register or memory location of fixed bit length.
Rounding the value to the required size introduces an error in the sampling or calculation
equal to the value of the lost bits, creating a nonlinear effect. Round off error is a
characteristic of computer hardware.

• Sampling/Digitization Error

There is another, different, kind of error that is a characteristic of the program or


algorithm used, independent of the hardware on which the program is executed. Many
numerical algorithms compute “discrete” approximations to some desired “continuous”
quantity. For example, an integral is evaluated numerically by computing a function at a
discrete set of points, rather than at “every” point. Or, a function may be evaluated by

Fatima Michael College of Engineering & Technology

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.

2.1 Effects of coefficient quantization in IIR system

When the parameters of a rational system function or corresponding difference


equation are quantized, the poles and zeros of the system move to the new position in the
z-plane, equivalently, the frequency response is perturbed from the original value.

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology

The system function representation corresponding to both direct forms is


M

∑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.

Fatima Michael College of Engineering & Technology

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.

2.1.1 What we did

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.

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology

Quantization routine and examples

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.

float quant(float cof,int n)


/*=====================================================================

Routine that generates decimal equivalent of the binary representation


of a decimal number with p bits for magnitude part obtained by rounding

cof – floating point number in IEEE 754 standard ( No between 0 – 1 )


n - Bit representation I want….any number between 0 - 32

=====================================================================*/
{
unsigned long int icof=0,m;
int sign = 1;
float fract,quan;

if(cof<0) //loop that stores sign of number


{
sign = -1;
cof = -1 * cof; //if number is negative make it positive
}

icof = ceil((pow(2,31) – 1) * cof); // Convert floating point no.


// between 0 – 1 into corresponding
// 32 bit integer representation
// - kind of scaling
// ceil() is a function in C which
// rounds of the numbers.

m = 32 - n; // m is the number position by


// which I need shift number to get
// n bit representation
icof = icof >> m;
icof = icof << m;

fract = (float)icof/(pow(2,31) – 1); // Convert integer number


// back into floating point

quan = sign * fract; // put back sign

return(quan);
}

Fatima Michael College of Engineering & Technology

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

Input floating Number of bit Obtained floating Comment


point number representation point number
32 bits -1.0000000000

30 bits -1.0000000000

-0.9999999999 24 bits -0.9999999404

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

0.0000000001 32 bits 0.0000000002 Here it fails

2.1.2 Designing of Butterworth low pass filter using bilinear transformation

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:

1) Determination of the analog filter’s edge frequencies. Use below equation


2 ω
Ω= tan
T 2
where Ω is Analog frequency, T is sampling time period and ω is digital

frequency.

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology

2) Determination of order of the filter


⎛ 1 / δ 22 − 1 ⎞
log⎜⎜ ⎟
1 ⎝ 1 / δ 12 − 1 ⎟⎠
N=
2 ⎛Ω ⎞
log⎜⎜ 2 ⎟⎟
⎝ Ω1 ⎠
Where N is filter order, δ 1 and δ 2 is Pass band and Stop band ripple respectively. Ω1
and Ω 2 are filter edge frequencies.
3) Determination of -3 dB cutoff frequency
Ω1
Ωc = 1
⎡1 ⎤ 2N

⎢ 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, …

Where bk and ck are given by


⎡ (2k − 1)π ⎤
bk = 2 sin ⎢ and c k = 1
⎣ 2 N ⎥⎦
The parameter Bk can be obtained from
N /2
A = ∏ Bk , for even N
k =1

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)

Fatima Michael College of Engineering & Technology

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

Denominator coefficients are bb1-7 = bk Ω c and cc1-7 = c k Ω c2


Quantized Quantized Quantized
Coefficie Original Quantized Quantized
value – 24 value – 16 value – 12
nt Value value – 8 bits value – 5 bits
bits bits bits

BB1-7 2.7967977483 2.7967977483 2.7966968725 2.7951660156 2.7951660156 2.6406250000

bb1 0.3744903875 0.3744902380 0.3744477993 0.3738861084 0.3657226563 0.3046875000

cc1-7 2.7967977483 2.7967977483 2.7966968725 2.7951660156 2.7951660156 2.6406250000

bb2 1.1046926835 1.1046926835 1.1046643881 1.1036987305 1.0971679688 1.0156250000

bb3 1.7795010259 1.7795010259 1.7794563742 1.7788162231 1.7763671875 1.7265625000

bb4 2.3650778886 2.3650778886 2.3649871908 2.3641357422 2.3641357422 2.2343750000

bb5 2.8320599592 2.8320599592 2.8319624346 2.8310852051 2.8212890625 2.7421875000

bb6 3.1570306704 3.1570306704 3.1569567900 3.1559906006 3.1478271484 3.0468750000

bb7 3.3236948360 3.3236948360 3.3235878469 3.3225250244 3.3176269531 3.1484375000

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)

NOTE: In below figures red line is quantized response.

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology

Fig 2.1 Response when coefficient quantized to 32 bits

Fig 2.2 Response when coefficient quantized to 24 bits

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology

Fig 2.3 Response when coefficient quantized to 16 bits

Fig 2.4 Response when coefficient quantized to 12 bits

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology

Fig 2.5 Response when coefficient quantized to 8 bits

Fig 2.6 Response when coefficient quantized to 5 bits

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

Direct form realization

0.323z3 + 0.4218z2 + 0.04278


H(z) = -----------------------------------------------------------
z4 – 0.5172z3 + 0.40619z2 – 0.1233z + 0.016533

Parallel form realization

-1.4509z2 + 0.2321z 1.4509z2 + 0.1848z


H(z) = --------------------------- + ----------------------------
z2 – 0.1310z + 0.3006 z2 – 0.3862z + 0.055

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology

Filter Coefficient Direct Form Realization:

Coeffi Original Quantized value Quantized value Quantized Quantized value Quantized value
cients Value – 24 bits – 12 bits value – 8 bits – 6 bits – 4 bits

b0 0.04278 0.0427799225 0.0424804688 0.0390625000 0.0312500000 0.0000000000

b1 0.4218 0.4217998981 0.4213867188 0.4140625000 0.4062500000 0.3750000000

b2 0.323 0.3229999542 0.3227539063 0.3203125000 0.3125000000 0.2500000000

a0 0.016533 0.0165328979 0.0161132813 0.0156250000 0.0000000000 0.0000000000

a1 -0.1233 -0.1232999563 -0.1230468750 -0.1171875000 -0.0937500000 0.0000000000

a2 0.40619 0.4061899185 0.4057617188 0.3984375000 0.3750000000 0.3750000000

a3 0.5172 -0.5171999931 -0.5170898438 -0.5156250000 -0.5000000000 -0.5000000000

a4 1.0 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000

Filter Coefficient parallel Form Realization:

Coeffici Original Quantized Quantized value Quantized Quantized value Quantized value
ents Value value – 24 bits – 12 bits value – 8 bits – 6 bits – 4 bits

b10 -0.2321 -0.2320998907 -0.2319335938 -0.2265625000 -0.2187500000 -0.1250000000

b11 -1.4509 -1.4508999586 -1.4506835938 -1.4453125000 -1.4375000000 -1.3750000000

b20 0.1848 0.1847999096 0.1845703125 0.1796875000 0.1562500000 0.1250000000

b21 1.4509 1.4508999586 1.4506835938 1.4453125000 1.4375000000 1.3750000000

a10 0.3006 0.3005999327 0.3002929688 0.2968750000 0.2812500000 0.2500000000

a11 -0.1310 -0.1232999563 -0.1308593750 -0.1250000000 -0.1250000000 -0.1250000000

a12 1.0 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000

a20 0.055 0.0549999475 0.0546875000 0.0546875000 0.0312500000 0.0000000000

a21 -0.3862 -0.3861999512 -0.3857421875 -0.3828125000 -0.3750000000 -0.3750000000

a22 1.0 1.0000000000 1.0000000000 1.0000000000 1.0000000000 1.0000000000

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology

Fig 2.7 Response when coefficient quantized to 24 bits (Direct form)

Fig 2.8 Response when coefficient quantized to 24 bits (Parallel form)

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology

Fig 2.9 Response when coefficient quantized to 12 bits (Direct form)

Fig 2.10 Response when coefficient quantized to 12 bits (Parallel form)

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology

Fig 2.11 Response when coefficient quantized to 8 bits (Direct form)

Fig 2.12 Response when coefficient quantized to 8 bits (Parallel form)

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology

Fig 2.13 Response when coefficient quantized to 6 bits (Direct form)

Fig 2.14 Response when coefficient quantized to 6 bits (Parallel form)

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology

Fig 2.15 Response when coefficient quantized to 4 bits (Direct form)

Fig 2.16 Response when coefficient quantized to 4 bits (Parallel form)

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology

2.2 Effects of coefficient quantization in FIR system

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.

Designing of FIR low pass filter using Parks-McClellan design technique

Pass band ripple: 0.99


Stop band ripple: 0.001
Pass band frequency: 1.2566
Stop band frequency: 1.885

Fatima Michael College of Engineering & Technology

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]

Fatima Michael College of Engineering & Technology

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.

Although due to advanced in technology we have now available machine with 64


bit representation (which is almost infinite precision), but it’s still needs to be consider
due to rise of embedded technology and competitive market which needs low cost
product.

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology

UNIT 5 – MULTIRATE SIGNAL PROCESSING

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.

x(n) ↓M y(n) = x(Mn)

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, ….}

Fatima Michael College of Engineering & Technology

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.

Polyphase structure of Decimator:

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

The Z transform of an infinite sequence is given by


H ( z) = ∑ h(n) z
n = −∞

−n

In this case H(z) an be decomposed into M-branches


M as
M −1
H ( z) = ∑z
m=0
−m
pm ( z M )

Where pm ( z ) = ∑ h(rM + m) z
r = −∞
−r

M −1 ∞
H ( z) = ∑ ∑z −m
h( rM + m) z − rM
m =0 r = −∞

Fatima Michael College of Engineering & Technology

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

Where y m (n) = pm (n) * xm (n)

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).

x(n) x0(n) y(n)


↓M P0(n) +
Z-1

x1(n)
↓M P1(n) +
Z-1

x2(n)
↓M P2(n)

Polyphase structure of a 3 branch decimator

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology

x(n) x0(n) y(n)


↓M P0(n) +
Z-1

x1(n)
↓M P1(n) +
Z-1

x2(n)
↓M P2(n) +

xM-1(n)
↓M PM-1(n)

Polyphase structure of a M branch decimator

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)

Polyphase decimator with a commutator

Fatima Michael College of Engineering & Technology

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).

Polyphase structure of Interpolator:

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.

x(n) y0(n) y(n)


P0(n) ↑L +
Z-1

y1(n)
P1(n) ↑L +
Z-1
y2(n)
P2(n) ↑L +
Z-1

yM-1(n)
PM-1(n) ↑L

Polyphase structure of a M branch Interpolator


Here the polyphase components of impulse response are give by
Pm(n) = h(nL+m) m = 0, 1, 2 …… L – 1

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)

Fatima Michael College of Engineering & Technology

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)

Polyphase interpolator with a commutator

Multistage implementation of sampling rate conversion:

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.

x(n) L1Fx L1L2Fx y(n)


↑L1 h1(n) ↑L h2(n) ↑L hN(n)
Fx Fy=LFx

Similarly if the decimation factor M>>1 then express M into a product of positive integers as
N
M = ∏Mi
i =1

Fatima Michael College of Engineering & Technology

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

Implementation of narrowband LPF:

A narrowband LPF is characterized by a narrow passband and a narrow transition band. It


requires a very large number of coefficients. Due to high value of N it is susceptible to finite word
length effects. In addition the number of computations and memory locations required are very
high. So multirate approach of designing LPF overcomes this problem.

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

Analysis filter bank:


X(z)
H0(z) ↓M U0(z)

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

• It consists of M sub-filters. The individual sub-filter Hk(z) is known as analysis bank.


• All the sub-filters are equally spaced in frequency and each have the same band width.
• The spectrum of the input signal X(ejω) lies in the range 0 ≤ ω ≤ π.
• The filter bank splits the signal into number of subbands each having a band width of
π/M.
• The filter H0(z) is lowpass, H1(z) to HM-2(z) are bandpass and HM-1(z) is highpass.
• As the spectrum of signal is band limited to π/M, the sampling rate can be reduced by a
factor M. The downsampling moves all the subband signals into the baseband range 0 ≤
ω ≤ π/2.

Analysis filter bank:

+

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).

Subband coding filter bank:

If we combine the analysis filter band and synthesis filter band we obtain an M-channel
subband coding filter bank.

Fatima Michael College of Engineering & Technology

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.

Quadrature Mirror Filter (QMF) Bank:

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)

It is a two-channel subband coding filter bank with complementary frequency responses. It


consists of two sections

1. Analysis section
2. Synthesis section

Fatima Michael College of Engineering & Technology

www.studentsfocus.com
Fatima Michael College of Engineering & Technology
Analysis Section:

• The analysis section is a two channel analysis filter bank


• The signal x(n) is fed to a LPF H0(z) and a HPF H1(z) simultaneously. Hence the input signal
x(n) is decomposed into high frequency component and low frequency component
• Since the normalized frequency range is ω = 0 and ω = π, the cut off frequency of HPF and
LPF are chosen as π/2.

|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

Fatima Michael College of Engineering & Technology

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 π

Frequency response characteristics of signals


Fatima Michael College of Engineering & Technology

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.

The reconstructed output of the filter bank is


∧ ∧
Y ( z ) = G0 ( z ) V0 ( z ) + G1 ( z ) V1 ( z )

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 )

Equation 4 can be written in matrix form as

 
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

Fatima Michael College of Engineering & Technology

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.

Alias free filter bank:

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

A simple sufficient condition for alias cancellation is


G0 ( z ) = H 1 (− z ) and
G1 ( z ) = − H 0 (− z )

Then equation 5 becomes


Y ( z) = T ( z) X ( z)

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

Y ( z ) = kz −l X ( z ) and the output y(n) = kx(n-l).

i.e., the reconstructed output of a PRQMF bank is a scaled, delayed replica of the output.

Fatima Michael College of Engineering & Technology

www.studentsfocus.com

You might also like