dsp first, 2/e reading assignmentsdspfirst.gatech.edu/archives/lectures/dspfirst-l17-pp4.pdf · dsp...
TRANSCRIPT
DSP First, 2/e
Lecture 17DFT: Discrete Fourier
Transform
READING ASSIGNMENTSREADING ASSIGNMENTS
This Lecture: Chapter 8, Sections 8-1, 8-2 and 8-4
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 3
LECTURE OBJECTIVESLECTURE OBJECTIVES Discrete Fourier Transform Discrete Fourier Transform
1
)/2(][][N
nkNjenxkX
1
)/2(][1][N
nkNjekXnx
DFT from DTFT by frequency samplingfrequency sampling
0
][][n
enxk 0
][][kN
y q y p gq y p g
DFT computation (FFT)
DFT pairs and propertiesPeriodicity in DFT (time & frequency)
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 4
Periodicity in DFT (time & frequency)
Sample the DTFT DFTSample the DTFT DFT Want computable Fourier transformWant computable Fourier transform Finite signal length (L) Finite number of frequenciesq
njj enxeX ˆˆ ][)(
1
ˆˆ ][)(L
njj kk enxeX n
0n
1,2,1,0,)/2(ˆ NkkNk
][][)()(:Periodic ˆ)2ˆ( kXNkXeXeX jj
k is the frequency index
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 5
][][)()(:Periodic )( kXNkXeXeX jj
Want a Computable INVERSE Fourier TransformINVERSE Fourier Transform Write the inverse DTFT as a finite Riemann sum:
1
0
)/2(2
ˆˆ )(lim][N
k
nNkjj
NeeXnx k
Note that
0k
NN 1
2/2
2ˆ )()(
Propose:
)(][where,][1][ ˆ1
)/2( kjN
nNkj eXkXekXN
nx
This is the inverse Discrete Fourier Transform (IDFT)
)(][,][][0kN
1N
Aug 2016 6© 2003-2016, JH McClellan & RW Schafer
DFTforward be will,][][1
0
)/2(
N
k
nNkjenxkX
Inverse DFT when L=N (proof)(proof) Complex exponentials are ORTHOGONALComplex exponentials are ORTHOGONAL
][1][1
0
)/2(ekXN
nxN
k
nkNj
][1 1)/2(
1)/2(
0
eemxN
NN
nkNjN
mkNj
k
][1 1 1)/2()/2(
0 0
eemx
NN N
nkNjmkNj
k m
][][1
][
1 1)()/2(
0 0
nxemx
eemxN
N NmnkNj
m k
mnmnN
mnN0
][
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 7
][][0 0
)()( nxemxN m k
j
Orthogonality of Complex ExponentialsExponentials
The sequence set: 110for1)/2(
NneNknNj The sequence set:
11 1)()/2(
1)/2()/2( eee
NmknNj
NmnNjknNj
1,,1,0for 0 Nne k
,111 )(2
00
mke
eN
eeN
mkj
nn
otherwise ,01 )()/2(eN mkNj
b Nk0 Nk ||because ,
and
Nmk ,0
Ne lj
21lim
Nmk ||
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 8
and Ne lNjl
)/2(0 1
lim
4-pt DFT: Numerical Examplep p
Take the 4 pt DFT of the following signal Take the 4-pt DFT of the following signal]1[][][ nnnx ]0,0,1,1[]}[{ nx
20011]3[]2[]1[]0[]0[ 0000 jjjj exexexexX
2/32/22/0 ]3[]2[]1[]0[]1[ jjjjX 4/
2/32/22/0
21
]3[]2[]1[]0[]1[
j
jjjj
ej
exexexexX
320 jjjj 00011]3[]2[]1[]0[]2[ 320 jjjj exexexexX
2/932/30 ]3[]2[]1[]0[]3[ jjjj exexexexX
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 9
4/21
][][][][][jej
N-pt DFT: Numerical Examplep p
Take the N pt DFT of the impulse Take the N-pt DFT of the impulse][][ nnx ]0,0,0,1[]}[{ nx
1
)/2(][][N
nkNjenkX
0
)/2(
0
1][ nkNj
n
en 0
1][n
en
]1,,1,1,1[]}[{ kX
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 10
],,,,[]}[{
4-pt iDFT: Numerical Example4 pt iDFT: Numerical Example
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 11
Matrix Form for N-pt DFTMatrix Form for N pt DFT In MATLAB, NxN DFT matrix is dftmtx(N), ( )
• Obtain DFT by X = dftmtx(N)*x• Or, more efficiently by X = fft(x,N)
• Fast Fourier transform (FFT) algorithm later
]0[1111]0[ xX
]2[]1[
11
]2[]1[
/)1(4/8/4
/)1(2/4/2
xx
eeeeee
XX
NNjNjNj
NNjNjNj
]1[1]1[ /)1)(1(2/)1(4/)1(2 NxeeeNX NNNjNNjNNj
Signal
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 12
DFT matrixSignalvector
FFT: Fast Fourier TransformFFT: Fast Fourier Transform
FFT is an algorithm for computing the DFT FFT is an algorithm for computing the DFT
N log2N versus N2 operationsg2 p Count multiplications (and additions) For example, when N = 1024 = 210
≈10,000 ops vs. ≈1,000,000 operations ≈1000 times faster
What about N=256, how much faster?
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 13
Zero-Padding gives denser FREQUENCY SAMPLINGFREQUENCY SAMPLING
W t l f DTFT Want many samples of DTFT WHY? to make a smooth plot Finite signal length (L) Finite number of frequencies (N)
ˆj Thus, we need
1
ˆˆL
jj
)(][,, ̂jeXkXNNL
0
][)(n
njj kk enxeX
1,2,1,0,)/2(ˆ NkkNk
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 14
1,2,1,0,)/2( NkkNk
Zero-Padding with the FFTZero-Padding with the FFT
Get many samples of DTFT Get many samples of DTFT Finite signal length (L)
Fi it b f f i (N) Finite number of frequencies (N) Thus, we need )(][,, ̂jeXkXNNL
In MATLAB• Use X = fft(x,N)
Wi h l h N• With L=length(x) less than N• Define xpadtoN = [x,zeros(1,N-L)];• Take the N pt DFT of xpadtoN
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 15
• Take the N-pt DFT of xpadtoN
DFT periodic in k (frequency domain)(frequency domain) Since DTFT is periodic in frequency the DFT Since DTFT is periodic in frequency, the DFT
must also be periodic in k)(][ )/2( kNjeXkX
What about Negative indices and Conjugate)()()(][
)(][)/2())/2())(/2())(/2( kNjNNkNjNkNj eXeXeXNkX
eXkX
What about Negative indices and Conjugate Symmetry?
)()( )/2()/2( XX kNjkNj ]1[]31[32
XXN
][][)()( )/2()/2(
kXkXeXeX kNjkNj
]2[]30[]1[]31[
XXXX
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 16
][][ kXkNX ]3[]29[ XX
DFT Periodicity in Frequency IndexFrequency Index
)()(][ )/2(ˆ eXeXkX kNjj k
1,2,1,0)()(][ )(
NkeXeXkX jj k
)()(][][ ˆ)2ˆ( jj eXeXkXNkX )()(][][ eXeXkXNkX
]2[]2[],[][
XNXkXkNX
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 17
]2[]2[,e.g. XNX
DFT pairs & propertiesDFT pairs & properties
Recall DTFT pairs because DFT is sampled DTFT Recall DTFT pairs because DFT is sampled DTFT See next two slides
DFT acts on a finite-length signal so we can useDFT acts on a finite-length signal, so we can use DTFT pairs & properties for finite signals
Want DFT properties related to computation
A d ill t t i And, we will concentrate on one more pair: DTFT and DFT of finite sinusoid (or cexp)
Length-L signal Length-L signal N-pt DFT
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 18
Th 3 i l h i fi it l thThese 3 signals have infinite length
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 19
Summary of DTFT PairsSummary of DTFT Pairs
Aug 2016 20© 2003-2016, JH McClellan & RW Schafer
These 3 properties involve circular indexingThese 3 properties involve circular indexing
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 21
Aug 2016 22© 2003-2016, JH McClellan & RW Schafer
Convolution Property not the samethe same Almost true for DFT:Almost true for DFT: Convolution maps to multiplication of transforms
Need a different kind of convolution Need a different kind of convolution CIRCULAR CONVOLUTION
LATER i d d DSP LATER in an advanced DSP course
Like ise for Time Shifting Likewise, for Time-Shifting Has to be circular Because the “n” domain is also periodic
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 23
Delay Property of DFTDelay Property of DFT
Recall DTFT propert for time shifting Recall DTFT property for time shifting:dnjjj
d eeXeYnnxny ˆˆˆ )()(][][
Expected DFT property via frequency sampling
I di h t b l t d
dnNkjd ekXkYnnxny )/2(][][][][
Indices such as must be evaluated modulo-N because
dnn dd nNkjNnNkj ee )/2())(/2(
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 24
DTFT of a Length-L PulseDTFT of a Length L Pulse
Know DTFT of finite rectangular pulse Know DTFT of finite rectangular pulse Dirichlet form and a linear phase term
1 )ˆsin(01 LLn 2/)1(ˆ
21
21
ˆ
)ˆsin()sin()(
otherwise001
][
Ljj eLeXLn
nx
)ˆsin()ˆsin()ˆ(
21
21
LDL
Use frequency-sampling to get DFT)1)(/(2/)1)(/2(2
1)/2())/2(sin(][ LNkjLNkj eNkDeNkLkX
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 25
21
)/2())/2(sin(
][ L eNkDeNk
kX
DTFT of a Finite Length Complex Exponential (1)Complex Exponential (1) Know DTFT of finite rectangular pulseKnow DTFT of finite rectangular pulse Dirichlet form and a linear phase term
2/)1(ˆ21
ˆ )ˆsin(01 Ljj LLn 2/)1(
21
2
)ˆsin()sin()(
otherwise00
][
Ljj eLeXn
nx
Use frequency shift property)ˆsin()ˆsin()ˆ(
21
21
LDL
Use frequency-shift property2/)1)(ˆˆ(
102
1ˆ
ˆ0
0
))ˆˆ(i ())ˆˆ(sin()(
th i00
][
Ljjnj
eLeYLne
ny
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 26
021 ))(sin(otherwise0
DTFT of a Finite Length Complex Exponential (2)Complex Exponential (2) Know DTFT, so we can sample in frequencyKnow DTFT, so we can sample in frequency
2/)1)(ˆˆ(
021
021
ˆˆ
00
))ˆˆ(sin())ˆˆ(sin()(
otherwise00
][
Ljjnj
eLeYLne
ny
Thus, the N-point DFT is02 ))((otherwise0
ˆ j ˆ0
00
][
nj
NnLLne
ny
Dirichlet Function
2/)1)(ˆ(02
21
2ˆ
02))ˆ(sin(][
ˆat)(][
LjNk
Nkj
Nk
eLkY
eYkY
)ˆsin()ˆsin()ˆ(
21
21
LDL
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 27
02
21 ))ˆ(sin(
][
N
k ekY
20-pt DFT of Complex ExponentialExponential
)5.2(ˆ 20 N
21ˆ20 ))ˆ(sin(0 knj kLLne 2/)1)(ˆ(
02
21
021
110
20
))ˆ(sin())(sin(][
otherwise00
][
Lj
NkN
jN
k
eLkXLne
nx
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 28
form Dirichletshifteda is outline theso)ˆsin()ˆsin()ˆ(
21
21
LDL
20-pt DFT of Complex Exp: “on the grid” the grid
)2(ˆ 20 N
/))(ˆ(21ˆ
20 ))ˆ(sin(0 knj kLLne 2/)1)(ˆ(
02
21
021
220
2
))ˆ(sin())(sin(][
otherwise00
][
Lj
NkN N
k
eLkXLne
nx
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 29form Dirichletshifteda is outline theso)ˆsin()ˆsin()ˆ(
21
21
LDL
50-pt DFT of Sinusoid: zero paddingpadding
50,202
NL
4.0)10(ˆ 20 N
?
04 otherwise0
0)ˆcos(][
LnnA
nx
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 30
2/)1)(ˆ(0
2212/)1)(ˆ(
02
21
40
20
2
)ˆ()ˆ(][ LjN
kL
LjN
kL
Nk
Nk
eADeADkX
RECALL: BandPass Filter (BPF)( )
fFrequency shiftingup and down is doneby cosine multiplicationin the time domain
BPF i f hift d
in the time domain
BPF is frequency shiftedversion of LPF (below)
)ˆsin()ˆcos(2][ diff2
1
midBP nnnnh
ˆ|ˆ|ˆ1ˆ|ˆ|0
)(21
1
coco
coˆ
BPj
DTFTeH
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 31
|ˆ|ˆ0
2co
50-pt DFT of Sinusoid: zero paddingpadding
50,202
NL
4.0)10(ˆ 20 N
?
Zero-crossings of Dirichlet ?Width of Dirichlet ?
Thus we havea simple BPF
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 32
Density of frequency samples?