of 126 /126
DFT : The Discrete Fourier Transform Chapter 8
• Author

others
• Category

Documents

• view

0

0

Embed Size (px)

Transcript of DFT : The Discrete Fourier Transform

Microsoft PowerPoint - DSP_Chapter_8Chapter 8
Roots of Unity
Definition: An Nth root of unity is a complex number x such that xN = 1
The Nth roots of unity are: ω0, ω1, …, ωN-1 where ω = e 2π j/N. Proof: (ωk)N = (e 2π j k / N) N = (e π j ) 2k = (-1) 2k = 1.
In DSP, we often take the principal root of unity as
ω0 = 1
8W
Properties of N-th Root of Unity
There are exactly N N-th roots of unity: WN 0, WN
1 , WN 2 , …, WN
N-1
WN is called the principal N-th root of unity The inverse of WN : WN
-1 = WN N-1
N =1 WdN
dk = WN k
N/2 = W(N/2)*2 N/2 = (by property 3) W2 = = -1
If N>0 and N is even, then (WN k )2 = WN/2
k , k = 0, 1, …, N–1
2 /j N NW e π−=
2 /( )j dN dke π− 2 /( )j N ke π−
2 / 2je π−
N k n
N k k n N N
k rN W
N k rN
Circular Shift of a Sequence
Consider length-N sequences defined for
Values of such sequences are not defined for n < 0 and If x[n] is such a sequence, then for any arbitrary integer , the shifted sequence is no longer defined for the range We thus need to define another type of a shift that will always keep the shifted sequence in the range
Nn ≥
5
The desired shift, called the circular shift, is defined using a modulo operation:
For (right circular shift), the above equation implies
[ ] [(( )) ]c o Nx n x n n= −
0>on
−≤≤ 0for
1for
0[ ] [ ] [ ] [ ]cx n x n x n n x n−periodic extension
shift take one period
][nx 6[(( 1)) ]x n −
6[(( 5)) ]x n= + 6[(( 2)) ]x n= +
6[(( 4)) ]x n −
7
As can be seen from the previous figure, a right circular shift by is equivalent to a left circular shift by sample periods
A circular shift by an integer number greater than N is equivalent to a circular shift by
on onN −
Circular Time Shift
Points shifted out to the right don’t disappear – they come in from the left
Like a ‘barrel shifter’:
g[((n-2))5]
origin pointer
Circular Time Reversal
Time reversal is tricky in ‘modulo-N ’ indexing - not reversing the sequence:
Zero point stays fixed; remainder flips
1 2 3 4 n5 6 7 8 9 10 11-7 -6 -5 -4 -3 -2 -1
[ ]x n
Time-reversed periodic sequence
1 2 3 4 n5 6 7 8 9 10 11-7 -6 -5 -4 -3 -2 -1
[ ](( ))Nx n−
[ ] [ ] [ ] [ ]rx n x n x n x n−periodic extension
reversal take one period
Discrete-Time Fourier Transform (DTFT)
The DTFT is useful for the theoretical analysis of signals and systems. But, the definition of DTFT is
The numerical computation of DTFT has several problems: Problem 1: The summation over n is infinite Problem 2: The independent variable ω is continuous DTFT and z-transform are not numerically computable transforms.
Approaches Problem 1 requirement 1 : If the sequence had only a finite number of non-zero terms!
This might be a good assumption since in many cases, we concern only a finite duration of the signal
• The signal itself might be of a finite duration • Only a segment is of interest at a time • Signal is periodic and thus has only finite number of
unique values Problem 2 Requirement 2 : If we needed to compute the spectra only at a finite number of frequencies!
This can be achieved by sampling the DTFT in the frequency domain or the z-transform on the unit circle. The remaining issue is that what will happen for the spectra at other frequencies. Aliasing?
DTFS for a periodic sequence satisfy both requirements
Analysis equation
Synthesis equation
But, DTFS is defined for only periodic signals!!!
Way to get there: Analyze periodic sequences on the basis that a periodic sequence can always be represented by a linear combination of harmonically related complex exponentials Discrete Fourier Series (DFS). Extend the DFS to finite-duration sequences Discrete Fourier Transform (DFT), the solution to the two problems!
[ ] 1
0
N
N −
=

= = −∑
For finite duration sequences, an alternative Fourier representation is DFT (Discrete Fourier Transform)
The summation over n is finite DFT itself is a sequence, rather than a function of a continuous variable Therefore, DFT is computable and important for the implementation of DSP systems DFT corresponds to the samples of the Fourier transform
DFT is very important in DSP systems since there is FFT (Fast Fourier Transform), an extremely efficient and fast way of computing DFT.
8.1 Discrete Fourier Series (DFS)
A discrete-time signal is periodic if
Fundamental period: the smallest positive integer N
Fundamental frequency:
The DFS can represent a periodic discrete signal by a linear combination of harmonically related complex exponentials.
The Fourier series representation of continuous-time periodic signals require infinite number of complex exponentials.
But for discrete-time periodic signals, we have
Due to the periodicity of the complex exponentials, we only need N exponentials for discrete time Fourier series
][~][~ Nnxnx +=
N/20 πω =
( )( ) ( ) ( ) ( )2 / 2 / 2 2 /j N k mN n j N kn j mn j N kne e e eπ π π π+ = =
DFS analysis and synthesis pair is expressed as follows:
The Fourier series coefficients can be obtained via
For convenience we may use the notation
Analysis equation
Synthesis equation
j N kn j N kn
k N k x n X k e X k e
N N π π
− −
=
=∑
[ ] 1
0
N
=
=∑
We can represent the signal with the DFS coefficients as
[ ] 1 [ ]
0r
else δ
0 0 [ ] [ ] 1
N N j N kn j N kn j N k
− − − − −
= =
= = = =∑ ∑
N πδ
∞ −
=−∞ =
= − =∑ ∑
Example 8.2 : Here let the Fourier series coefficients be the periodic impulse train Y[k] , and given by this equation:
Substituting Y[k] into DFS equation gives
Comparing this result with the results for Example 8.1, we see that Y[k]=Nx[k] and y[n]=X[n].
[ ] [ ] r
=−∞
= −∑
N δ
The DFS coefficients
0
j k n
π π π
Shift of a Sequence
←→ ←→
+ ←→ +
[ ] [ ] [ ] [ ]
x n X k x n m e X k
e x n X k m
π
π
←→ ←→ −
Let’s form the product
The periodic sequence with given DFS can be written as a periodic convolution
Periodic convolution is commutative
←→ ←→
[ ] [ ] [ ] 1

=
= −∑

=
= −∑
Interchange summations
Substituting
[ ] [ ] [ ] N N N
kn kn N N
− − −
= = =
= = −
∑ ∑ ∑
[ ] [ ] N N
kn N
− −
= =
= −
∑ ∑

=
− =∑
3 1 2 1 2 1 2 0 0 0
[ ] [ ] [ ] N N N
kn km N N
− − −
= = =
= − = =
∑ ∑ ∑
8.3 Fourier Transform of Periodic Signals
Periodic sequences are not absolute or square summable Hence they don’t have a Fourier Transform per se
We can represent them as sums of complex exponentials: DFS We can combine DFS and Fourier transform (Generalized) Fourier transform of periodic sequences
Periodic impulse train with values proportional to DFS coefficients
This is periodic with 2π since DFS is periodic The inverse transform can be written as
( ) [ ]2 2j
ω π πδ ω ∞
1 2 1
k
k k
kX e e d X k e d N N
kX k e d X k e N N N
π ε π εω ω ω
ε ε
πδ ω ω
Therefore the Fourier transform is
[ ][ ] r
( ) 2 2j
Relation between Finite-length and Periodic Signals
Consider finite length signal x[n] spanning from 0 to N-1 Convolve with periodic impulse train
The Fourier transform of the periodic sequence (called periodic extension) is
This implies that
DFS coefficients of a periodic expansion signal can be thought as equally spaced samples of the Fourier transform of one period (= the original finite duration sequence)
[ ] [ ][ ] [ ] [ ] [ ] r r
=−∞ =−∞
= ∗ = ∗ − = −∑ ∑
( ) ( ) ( ) ( )
kX e X e P e X e N N
kX e X e N N
ω ω ω ω
ω πω=
j jX e eω ω ω ω
−=
[ ] ( ) ( ) ( )
k π π
Consider an aperiodic sequence with its Fourier transform
Assume that a sequence is obtained by sampling the DTFT
Since the DTFT is periodic, resulting sequence is also periodic We can also write it in terms of the z-transform
The sampling points are shown in figure could be the DFS of a sequence
Write the corresponding sequence
ω π= = =
[ ] ( ) ( ) ( )( )2 /
π
N π
[ ]X k
The only assumption made on the sequence is that DTFT exist
Combine equation to get
So we get the periodic extension of x[n]
( ) [ ]j j m
∞ −
=−∞
N π
[ ] ( ) ( )
[ ] ( ) ( ) [ ] [ ]
k m
m k m
x m e x m p n m N
π π
k r p n m e n m rN
N π δ
=−∞ =−∞
= ∗ − = −∑ ∑
In this case, the Fourier series coefficients for a periodic sequence are samples of the Fourier transform of one period
In this case, still the Fourier series coefficients for are samples of the Fourier transform of x[n]. But, one period of is no longer identical to x[n]. This is just sampling in the frequency domain as compared in the time domain discussed before.
[ ]x n
[ ]x n
Samples of the DTFT of an aperiodic sequence can be thought of as DFS coefficients of a periodic sequence obtained through summing periodic replicas of original sequence. periodic expansion If the original sequence is of finite length and we take sufficient number of samples of its DTFT the original sequence can be recovered by
It is not necessary to know the DTFT at all frequencies to recover the discrete-time sequence in time domain Discrete Fourier Transform representing a finite length sequence by samples of DTFT
[ ] [ ] 0 1 0
else ≤ ≤ −
=
Time-domain aliasing The relationship between x[n] and one period of in the undersampled case is considered a form of time domain aliasing. Time domain aliasing can be avoided only if x[n] has finite length, just as frequency domain aliasing can be avoided only for signals being bandlimited. If x[n] has finite length and we take a sufficient number of equally spaced samples of its Fourier transform (specifically, a number greater than or equal to the length of ), then the Fourier transform is recoverable from these samples, equivalently is recoverable from .
[ ]x n
To avoid frequency-domain aliasing Signal is bandlimited Sampling rate in time-domain is high enough
To avoid time-domain aliasing Sequence is finite Sampling interval (2π/N) in frequency-domain is small enough
8.5 The Discrete Fourier Transform
Consider a finite length sequence x[n] of length N
For given length-N sequence associate a periodic sequence (a periodic extension)
The DFS coefficients of the periodic sequence are samples of the DTFT of x[n] Since x[n] is of length N there is no overlap between terms of x[n-rN] and we can write the periodic sequence as
To maintain duality between time and frequency We choose one period of as the Fourier transform of x[n]
[ ] 0 outside of 0 1x n n N= ≤ ≤ −
[ ] [ ] r
=−∞
= −∑
[ ]X k
else ≤ ≤ −
The DFS pair
The equations involve only one period so we can write
[ ] ( ) 1
2 /
0 [ ]
− −
=
=∑
[ ] ( )
X k else
x n N else
The Discrete Fourier Transform
[ ] [ ]DFTX k x n←→
X k else
x n N else
The Discrete Fourier Transform (DFT) of a finite length sequence
The Inverse Discrete Fourier Transform (IDFT) is defined by
A DFT and IDFT pair is shown as
{ } { }1,...,0for ][][DFT][ 1
The inverse discrete Fourier transform (IDFT) is given by
To verify the above expression we multiply both sides of the above equation by and sum the result from n = 0 to 1−= Nnn
NW
we observe that the RHS of the last equation is
but, for k=0,1,…,N-1, there is only one non-zero term at k=l , and RHS =
Hence
=
= − −∑
− −
=
= ≤ ≤ −∑
N π
Periodic Extension of DFT Sequence
We can show that the definitions of DFT and IDFT induces periodicity
1 2 /
− −
=
n N
n N
x n e e
π
k N
k N
X k e e N
X k e x n N
π
N π
DTFS and DFT
X[k] is the Fourier series coefficient (or spectral component) at the frequency Thus except the scale factor, we have the following relationship
Differences between the DFT and the DTFS the DFT assumes signal periodicity while the DTFS requires periodicity the DFT scales the synthesis equation by 1/N whereas the DTFS scales the analysis equation.
0kω
ˆ[ ] [ ]
D FT
ID FT
D TFS
[ ] ( )
( )
j k n
n j k
Still samples of the DTFT but in different places
8.6 Properties of DFT
0 n
−≤≤−=
0 10))(()(~
)( 1 1
)()( kXnx →←DFT
(2 / )(( )) , 0 1 ( ) ( )j N km km N Nx n m n N e X k W X kπ−− ≤ ≤ − ←→ =DFT
53
Duality
* * *
(( )) [ ] [ ] ( ) [ ] [ ]
− ↔ − = −
↔ − = −
Review: Even and Odd Components
Any real-valued signal can be expressed as the sum of an odd signal and an even signal.
( ) ( ) ( ) [ ] [ ] [ ] where
and 1 1( ) { ( ) ( )} [ ]= { [ ] [ ]} an odd function 2 2
e o e o
e e
o o
x t x t x t x n x n x n
x t x t x t x x n x n
= + = +
= + − + −
= − − − −
For a real finite duration sequence
( ) ( )
( ) ( )
e
o
= + − = + −
= − − = − −
Review: Even and Odd Components
If x(t) is a complex valued function: x(t)=xR(t) + j xI(t) x(t) is even iff both the real and imaginary parts of x(t) are even. Similarly x(t) is odd iff both the real and imaginary components of x(t) are odd.
We can also define conjugate symmetry, or Hermitian symmetry: real part of x(t) is even but the imaginary part of x(t) is odd
xR(t)= xR(-t) and xI(t)= -xI(-t) i.e. x*(t)= x*(-t)
59
R I e o e o R R I I
R I e o e o R R I I
x n x n jx n
x n x n j x n x n X k X k jX k
X k X k j X k X k
= +
= + + + = +
= + + +
( ) [ ( ) ( )] [ ( ) ( )]
( ) [ ( ) ( )] [ ( ) ( )]
= + + +
= + + +
X k jX k
X k jX k
61
The Fourier transform of real signals exhibits special symmetry which is important to us in many cases. Basically, The transform of a real signal x[n] is therefore conjugate Symmetric (Hermitian symmetric)
Real part Symmetric (even)
Magnitude Symmetric (even)
Phase Antisymmetric (odd)
62
Example
)(nx
ω→← jeXnx FT
Circular Convolution (Cyclic Convolution)
Circular convolution of two finite length sequences
[ ] [ ] [ ]
[ ] ( )( )
[ ] ( )( )
1 2 0 1
x m x n m
x m x n m n N

=

=

=
= −
= −
= − ≤ ≤ −

The cyclic convolution is not the same as the linear
convolution of linear system theory. It is a by-
product of the periodicity of DFS/DFT.
When the DFT X[k] is used, the periodic interpretation of the signal
x[n] is implicit: if
then for any integer m:
Thus, just as the DFT X[k] is implicitly period-N, the inverse DFT is
also implicitly period-N — the periodic extension of x[n].
][][][ nhnxny N ⊗=
( ) ( ) (( )) ( ) ( ) N
N m
=
= − =∑
)()( 11 kXnx →←DFT )()( 22 kXnx →←DFT
3 1 2 3 1 2( ) ( ) ( ) ( ) ( ) ( )x n x n x n X k X k X k= ←→ =DFT
both of length N
Proof: Circular Convolution Theorem
Suppose we have two finite duration sequences x1[n] and x2[n] of length N. Suppose we multiply the two DFTs together: X3[k] = X1[k]X2[k] What happens when I take the IDFT of X3[k] ?
1
1 1 1 ( )
1( ) [ ]
1 [ ]
1 [ ] [ ]
1 [ ] [ ]
k n l
n l k
X X k W N
x n W x l W W N
x n x l W N
− −
=
− −
=
− − − −
= = =
− − − + −
= = =
=
=
=

=

∑ ∑ ∑
∑ ∑ ∑
and we have , the circular convolution of x1 and x2
68
k
W iff n l m Np p N l m n NP m n
W otherwise
=
= −∑
L=N=6

−≤≤ −
− =
==
+−

= ∑
The procedure of each pair are summed around the circle.
In a while, it will be seen that can be computed using
][*][][ nhnxny =
DFT of each sequence
else ≤ ≤ −
else
π− −
= = =

x n else
≤ ≤ − =
We can augment zeros to each sequence L=2N=12 The DFT of each sequence
Multiplication of DFTs
π
π
Example : Consider the two length-4 sequences repeated below for convenience:
We will take DFT approach
n 3210
78
The 4-point DFT G[k] of g[n] is given by
Therefore
3021 232 ≤≤++= −− kee kjkj ,// ππ
79
Likewise,
3022 232 ≤≤+++= −−− keee kjkjkj ,// πππ
80
4
[0] [0] 1 1 1 1 1 4 [1] [1] 1 1 2 1
W [2] [2] 1 1 1 1 0 2 [3] [3] 1 1 1 1
− − − = = = − − − − − +
4
[0] [0] 1 1 1 1 2 6 [1] [1] 1 1 2 1
W [2] [2] 1 1 1 1 1 0 [3] [3] 1 1 1 1
− − − = = = − − − − +
81
Thus
4
[0] [0] [1] [1]1 *W [2] [2]4 [3] [3]
C C
C C
C C
C C
=

=

−− −− −−=
n1 2 3
n1 2 3
n
1 2 3
4
*
=
−∑
84

From the above
= − ≤ ≤∑
][nge ][nhe
[0] [0] [0] [1] [6] [2] [5] [3] [4] [4] [3] [5] [2] [6] [1]
[0] [0] 1 2 2
e e e e e e e e
e e e e e e
= + + + + + +
= = × =
,)()(][][][][][ 6222101101 =×+×=+= hghgy
87
As can be seen from the above that y[n] is precisely the sequence obtained by a linear convolution of g[n] and h[n]
][nyL
][nyL
define the periodic sequence by
does not have a z-transform or a convergent Fourier sum (why?). But it does have a DFS representation.
The DFS that is the true frequency representation of discrete-time periodic signals. The DFT is just one period of the DFS.
The length-N DFT of the length-N signal contains all the information about . It is convenient to work with.
Whenever the DFT is used, actually the DFS is being used – computations involving are affected by the true periodicity of the coefficients.
{ }1,...,0];[ −= Nnnx { }+∞<<−∞ nnx ];[~
][kX ][~ kX
DFT and z-Transform
The DFT samples the z-transform at evenly spaced samples of the unit circle over one revolution:
{ }1,...,0for |)(][ /2 −∈= =
NkzXkX Nkjez π
DFT and DTFT
The DFT samples on period of the discrete-time Fourier transform (DTFT) at N evenly spaced frequencies
{ }1,...,0for |)(][ /2 −∈= = NkeXkX Nk j
πω ω
It can readily be shown that
∑ ⋅
92
X Y Kω
Discrete-Time Fourier Transform (DTFT)
Discrete Fourier Transform (DFT)
1 ],[][~ 1 ],[][ <+=→<= ∑ ∞
πω ω
can be expressed in matrix form as
where and
10,][][ 1
=
N
2
1
N N N N N N
W W W W W WW
W W W
96
can be expressed in matrix form as
where is the IDFT matrix
1
0
N
( 1) 2( 1) ( 1)
1 1 1 1
N N N N N N
W W W
W W W
97
Example: Matrix Representation
0 0 0 0 4 4 4 4 0 1 2 3
4 4 4 4 4 0 2 4 6
4 4 4 4 0 3 6 9
4 4 4 4
W 1 1 1 1 1 1
W W W W j jW W W W
W W W W j jW W W W
− − = = − − − −
0 0 0 0 4 4 4 4 0 1 2 3
1 4 4 4 4 4 0 2 4 6
4 4 4 4 0 3 6 9
4 4 4 4
1 1 1 1 1 11W 1 1 1 14 1 1
W W W W j jW W W W
W W W W j jW W W W
− − − −
− − −
− − −
− − = = − − − −
Example : The DFT matrices of dimension 2, 3, 4 are as follows:
Suppose

8.7 Linier convolution using the DFT
Efficient algorithms are available for computing the DFT of finite- duration sequence, therefore it is computationally efficient to implement a convolution of two sequences by the following procedure:
Compute the N point discrete Fourier transforms X1[k] and X2[k] for the two sequences given. Compute the product X3[k]= X1[k]X2[k] Compute the inverse DFT of X3[k]
The multiplication of discrete Fourier transforms corresponds to a circular convolution. To obtain a linear convolution, we must ensure that circular convolution has the effect of linear convolution.
[ ] [ ] [ ]3 1 2 m
=−∞
= −∑
Implementing LTI systems using the DFT
Let us consider an L point input sequence x[n] and a P point impulse response h[n]. The linear convolution has finite-duration with length L+P-1. Consequently for linear convolution and circular convolution to be identical, the circular convolution must have the length of at least L+P-1 points.
i.e. both x[n] and h[n] must be augmented with sequence amplitude with zero amplitude.
This process is often referred to as zero-padding.
106
Linear convolution is a key operation in many signal processing applications Since a DFT can be efficiently implemented using FFT algorithms, it is of interest to develop methods for the implementation of linear convolution using the DFT Let g[n] and h[n] be two finite-length sequences of length N and M, respectively Pick Define two length-L sequences
1L N M= + −
Then
Length-M Length- )( 1−+ MN
[ ] [ ] [ ] [ ] [[ ] ]CLy n g n h n y n g n h n== =∗
The size of DFT to be used can be any integer L≥N+M-1
108
L0
Filtering Long Sequences
Sometimes we want to filter a sequence that is very long could save up all the samples, then either
» do a really long time-domain convolution, or » use really big DFTs to do it in the frequency domain
but big DFTs may become impractical; besides we get long latency: we have to wait a long time to get any output
Sometimes we want to filter a sequence of indefinite length and then even the methods above don’t work
111
Example: Filtering Long Sequences
Finite-length impulse response h[n] and indefinite-length signal x[n] to be filtered
Implementing Linear Time-Invariant Systems Using the DFT Theoretically, we store the entire samples and then implement the convolution procedure using a DFT for a large number points which is generally impractical to compute. No filter samples can be computed until all the input samples have been collected. Generally, we would like to avoid such a large delay in processing.
The solution of both problems is to use “block convoltuion”.
112
Block Convolution Techniques
All of samples will be segmented into section of appropriate length (L). Each section can then be convolved with the finite-length impulse response and the filtered sections fitted together in an appropriate way.