Digital Signal Processing: Dr. Muayad
Digital Signal Processing: Dr. Muayad
Lecture 7
Dr. Muayad
3rd year
The Discrete Fourier transforms (DFT)
7.1 Introduction
Frequency analysis of discrete-time signals is usually and most
conveniently performed on a digital signal processor, which may be a
general-purpose digital computer or specially designed digital hardware. To
perform frequency analysis on a discrete-time signal x(n), we convert the
time-domain sequence to an equivalent frequency-domain representation.
We know that such a representation is given by the Fourier transform X ( w )
of the sequence x(n). However, X(w) is a continuous function of frequency
and therefore. it is not a computationally convenient representation of the
sequence x(n). In this lecture ,we consider the representation of a sequence
x(n) by samples of its spectrum X(w). Such a frequency-domain
representation leads to the discrete Fourier transform (DFT), which is a
powerful computational tool for performing frequency analysis of discrete-
time signals. In other words, digital computers can only work with
information that is discrete and finite in length.
7.2 The Discrete Fourier Transform (DFT)
The DFT is the frequency-domain sampling of an aperiodic sequence x(n).
The discrete Fourier transform (DFT) of x(n) is defined as
… (7.1)
the frequency samples are obtained by evaluating the Fourier transform
X(w) at a set of N (equally spaced) discrete frequencies. In turn, the relation
which allows us to recover the sequence x(n) from the frequency samples is
… (7.2)
… (7.3)
… (7.4)
where, by definition,
… (7.5)
With these definitions, the N-point DFT may be expressed in matrix form as
… (7.7)
where WN is the matrix of the linear transformation.
expression for the IDFT
… (7.8)
The DFT copes with complex as well as real signal. Given the time
domain signal, the process of calculating the frequency domain is called
decomposition. The DFT of a signal x(n) defined over the range 0 ≤ 𝑛 ≤
𝑁−1
The additional value of the spectrum outside the range 0 ≤ 𝑘 ≤ 𝑁 − 1
form a periodic spectral sequence. Likewise, the additional of the signal x(n)
outside the range 0 ≤ 𝑛 ≤ 𝑁 − 1 yields a periodic version of the signal.
We can see that both DFT and IDFT represented finite length sequences as
one period of a periodic sequence.
The power 𝑊𝑁 for k = 0.. . N - 1 embraces all the N roots. Thinking of
the complex numbers as points in the plan𝑒 𝑊 𝑘𝑛 is clearly on the unit circle
(since its absolute value is one). Each successive power moves a further h
around the circle until for N = 1 we return to 𝑊𝑁0 = 1. This is illustrated in
the Figure (7.1) for N = 8. The power 𝑊𝑁 of must be determined for N=8,
where
𝑊𝑁0 = 𝑊𝑁8 = 𝑊𝑁16
𝑊𝑁1 = 𝑊𝑁9 = 𝑊𝑁17
𝑊𝑁2 = 𝑊𝑁10 = 𝑊𝑁18
𝑊𝑁3 = 𝑊𝑁11 = 𝑊𝑁17 and so on
Figure 7.1: The N complex roots of unity displayed graphically. (Here N = 8.)
We note that the computation of each point of the DFT can be accomplished
by N complex multiplications and (N-1) complex additions. Hence the N-
point DFT values can be computed in a total of 𝑁 2 complex multiplications
and N(N-1) complex additions.
Example (7.1):- Compute the DFT of the following four point sequence
x(n)=[0 1 2 3]
Solution:-
𝑘𝑛
𝑋(𝑘) = ∑𝑁−1
𝑛=0 𝑥(𝑛)𝑊𝑁 , the length of this signal is N=4
𝑋(0) = 𝑥(0)𝑊𝑁0 + 𝑥(1)𝑊𝑁0 + 𝑥(2)𝑊𝑁0 + 𝑥(3)𝑊𝑁0
𝑋(1) = 𝑥(0)𝑊𝑁0 + 𝑥(1)𝑊𝑁1 + 𝑥(2)𝑊𝑁2 + 𝑥(3)𝑊𝑁3
𝑋(2) = 𝑥(0)𝑊𝑁0 + 𝑥(1)𝑊𝑁2 + 𝑥(2)𝑊𝑁4 + 𝑥(3)𝑊𝑁6
𝑋(3) = 𝑥(0)𝑊𝑁0 + 𝑥(1)𝑊𝑁3 + 𝑥(2)𝑊𝑁6 + 𝑥(3)𝑊𝑁9
𝑋(𝑘) = 𝑊𝑁 𝑥(𝑛)
1 1 1 1 0
1 𝑊41 𝑊42 𝑊43 1
𝑋(𝑘) = [ ]
1 𝑊42 𝑊44 𝑊46 2
[1 𝑊43 𝑊46 𝑊49 ] 3
2𝜋𝑗
𝑊𝑁 = 𝑊4 = 𝑒 − 𝑁 = 𝑒 −𝜋𝑗/2 = −𝑗
ْ𝑋(0) 1 1 1 1 0 6
𝑋(1) 1 –𝑗 − 1 𝑗 1 −2 + 2𝑗
=[ ][ ] = [ ]
X(2) 1 −1 1−1 2 −2
[ X(3) ] 1 𝑗 −1 −𝑗 3 −2 − 2𝑗
ImagX(k)
2
1.5
0.5
-0.5
-1
-1.5
-2
0 1 2 3 4 5 6
k
ReX(k)
6
-1
-2
0 1 2 3 4 5 6
k
Figure (7.2) the 4-point DFT spectrum real and imaginary of example 7.1
Example (7.2):- Find the IDFT for the following spectrum to obtain the
original signal 𝑋(𝑘) = [2 1 + 𝑗 0 1 − 𝑗]
1
Solution: - 𝑥(𝑛) = ∑𝑁−1 −𝑘𝑛
𝑘=0 𝑋(𝑘)𝑊𝑁 , the length of this signal is N=4
4
1
𝑥(𝑛) = ∑3𝑘=0 𝑋(𝑘)𝑊𝑁−𝑘𝑛
4
𝑊𝑁 = 𝑊4 = −𝑗
1
𝑥(0) = [𝑋(0)(−𝑗)0 + 𝑋(1) + 𝑋(2) + 𝑋(3)] = 1
4
1
𝑥(1) = [𝑋(0)(−𝑗)0 + 𝑋(1)(−𝑗)−1 + 0 + 𝑋(3)(−𝑗)−3 ] = 0
4
1
𝑥(2) = [2(−𝑗)0 + 𝑋(1)(−𝑗)−2 + 0 + 𝑋(3)(−𝑗)−6 ] = 0
4
1
𝑥(3) = [2(−𝑗)0 + 𝑋(1)(−𝑗)−3 + 0 + 𝑋(3)(−𝑗)−9 ] = 1
4
… (7.9)
In using this property, it is important to ensure that the DFTs are the same
length. If x1(n) and x2(n) have different lengths, the shorter sequence must
be padded with zeros in order to make it the same length as the longer
sequence. For example, if x1(n) is of length N1and x2(n) is of length N2 with
N2 > N1. X1(n) may be considered to be a sequence of length N2 with the
last N2 - NI values equal to zero, and DFTs of length N2 may be taken for
both sequences.
2. Circular shift of a Sequence
The circular shift of a sequence x(n) is defined as follows:
𝑥((𝑛 − 𝑛0 ))𝑁 𝑅𝑁 (𝑛) = 𝑥𝑝 (𝑛 − 𝑛0 )𝑅𝑁 (𝑛)
Where no is the amount of the shift and 𝑅𝑁 (𝑛) is a rectangular
window. A circular shift may be visualized as follows. Suppose that
the values of a sequence x(n) from n = 0 to n =N - 1 , are marked
around a circle as illustrated in Figure (7.3 e). A circular shift to the
right by no corresponds to a rotation of the circle no positions in a
clockwise direction. Another way to circularly shift a sequence is to
form the periodic sequence xp( n ) , perform a linear shift, xp(n - no),
and then extract one period of xp(n - no) by multiplying by a
rectangular window as shown in Figure (7.3 a,b,c,d). Hence x'(n) is
simply x(n) shifted circularly by two units in time, where the
counterclockwise direction has been arbitrarily selected as the positive
direction. Thus we conclude that a circular shift of an N-point
sequence is equivalent to a linear shift of its periodic extension, and
vice versa.
the circular shift of the sequence can be represented as the index modulo N.
Thus we can write
… (7.12)
And
Then
… (7.15)
Where 𝑥1 (𝑛) N 𝑥2 (𝑛) denotes the circular convolution of the sequence
xl(n) and x2(n).
4. Time reversal of a sequence. If
Then
… (7.16)
Hence reversing the N-point sequence in time is equivalent to reversing the
DFT values. Time reversal of a sequence x(n) is illustrated in Figure 7.6.
.. (7.14)
it is not the ordinary linear convolution that, which relates the output
sequence y(n) of a linear system to the input sequence x(n) and the impulse
response h(n). Instead, the convolution sum in (7.14) involves the index ((m
-n))N and is called circular convolution.
The multiplication of the DFTs of two sequences is equivalent to the circular
convolution of the two sequences in the time domain.
Example (7.3) Perform the circular convolution of the following two
sequences:
Solution: Each sequence consists of four nonzero points. For the purposes
of illustrating the operations involved in circular convolution, it is desirable
to graph each sequence as points on a circle. Thus the sequences x l(n) and
x2(n) are graphed as illustrated in Figure(7.5) (a). We note that the sequences
are graphed in a counterclockwise direction on a circle. This establishes the
reference direction in rotating one of the sequences relative to the other.
Now, x3(m) is obtained by circularly convolving xl(n) with x2(n) as specified
by equation(7.14). Beginning with m = 0 we have
𝑥2 ((−𝑛))4 is simply the sequence 𝑥2 (𝑛)folded and graphed on a circle as
illustrated in Figure 7.5(b). In other words, the folded sequence is simply
x2(n) graphed in a clockwise direction. The product sequence is obtained by
multiplying 𝑥1 (𝑛) 𝑤𝑖𝑡ℎ 𝑥2 ((−𝑛))4 point by point. This sequence is also
illustrated in Figure 7.5(b). Finally, we sum the values in the product
sequence to obtain x3(0) =14
For m=1 we have
Thus
Example (7.5) use DFT and IDFT, determine the response of the FIR filter
with impulse response
Solution: The input sequence has length L = 4 and the impulse response has
length M = 3. Linear convolution of these two sequences produces a
sequence of length N = 6. Consequently, the size of the DFTs must be a1
least six. For simplicity we compute eight-point DFTs.
Hence
Yields
We observe that the first six values of y(n) constitute the set of desired
output values. The last two values are zero because we used an eight-point
DFT and IDFT, when, in fact, the minimum number of points required is six.