ee123 digital signal processing - eecs instructional ...ee123/sp15/notes/lecture05.pdf · ee123...
TRANSCRIPT
![Page 1: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/1.jpg)
M. Lustig, EECS UC Berkeley
EE123Digital Signal Processing
Lecture 5
based on slides by J.M. Kahn
![Page 2: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/2.jpg)
M. Lustig, EECS UC Berkeley
Info
• Last time– Finished DTFT Ch. 2– z-Transforms Ch. 3
• Today: DFT Ch. 8
• Reminders:– HW Due tonight
![Page 3: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/3.jpg)
The effects of sampling
What is going on here?
https://www.youtube.com/watch?v=bzjwnZDScxoRolling shutter effect
![Page 4: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/4.jpg)
M. Lustig, EECS UC Berkeley
Motivation: Discrete Fourier Transform
• Sampled Representation in time and frequency– Numerical Fourier Analysis requires discrete
representation– But, sampling in one domain corresponds to
periodicity in the other...– What about DFS (DFT)?
• Periodic in “time” ✓• Periodic in “Frequency” ✓
– What about non-periodic signals?• Still use DFS(T), but need special considerations
![Page 5: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/5.jpg)
Discrete Continuous
Periodic
Aperiodic
ContinuityPe
riod
icit
y
DFT, DFS
DTFT CTFT
CFS
Which transform? (Time-domain)
Time FrequencyPeriodic DiscreteDiscrete Periodic
Sometimes we use thisfor aperiodic signals, though!
![Page 6: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/6.jpg)
M. Lustig, EECS UC Berkeley
Motivation: Discrete Fourier Transform
• Efficient Implementations exist– Direct evaluation of DFT: O(N2)– Fast Fourier Transform (FFT): O(N log N)
(ch. 9, next topic....)
– Efficient libraries exist: FFTW• In Python:> X = np.fft.fft(x);> x = np.fft.ifft(X);
– Convolution can be implemented efficiently using FFT• Direct convolution: O(N2)• FFT-based convolution: O(N log N)
![Page 7: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/7.jpg)
M. Lustig, EECS UC Berkeley
Discrete Fourier Series (DFS)
![Page 8: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/8.jpg)
M. Lustig, EECS UC Berkeley
Discrete Fourier Series (DFS)
• Define:
• DFS:
Properties of WNkn?
![Page 9: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/9.jpg)
M. Lustig, EECS UC Berkeley
Discrete Fourier Series (DFS)
• Properties of WN:– WN0 = WNN = WN2N=...=1– WNk+r = WNKWNr or, WNk+N = WNk
• Example: WNkn (N=6)k=1
n=1n=2
n=3
n=4n=5
n=0,6
k=2
n=1,4,7,
n=2,5, n=0,3,6,
![Page 10: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/10.jpg)
M. Lustig, EECS UC Berkeley
Discrete Fourier Transform
• By Convention, work with one period:
Same same..... but different!
![Page 11: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/11.jpg)
M. Lustig, EECS UC Berkeley
Discrete Fourier Transform
Inverse DFT, synthesis
DFT, analysis
• It is understood that,
![Page 12: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/12.jpg)
M. Lustig, EECS UC Berkeley
Discrete Fourier Transform
• Alternative formulation (not in book)Orthonormal DFT:
Inverse DFT, synthesis
DFT, analysis
Why use this or the other?
![Page 13: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/13.jpg)
M. Lustig, EECS UC Berkeley
Comparison between DFS/DFT
DFS
DFT
![Page 14: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/14.jpg)
M. Lustig, EECS UC Berkeley
Example
0 1 2 3 4
1
• Take N=5
“5-point DFT”
![Page 15: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/15.jpg)
M. Lustig, EECS UC Berkeley
Example
A: where is a period-10 seq.
“10-point DFT”
![Page 16: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/16.jpg)
M. Lustig, EECS UC Berkeley
Example
• Show:
“10-point DFT”
4
![Page 17: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/17.jpg)
M. Lustig, EECS UC Berkeley
DFT vs DTFT
• For finite sequences of length N:– The N-point DFT of x[n] is:
–The DTFT of x[n] is:
What is similar?
![Page 18: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/18.jpg)
M. Lustig, EECS UC Berkeley
DFT vs DTFT
• The DFT are samples of the DTFT at N equally spaced frequencies
![Page 19: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/19.jpg)
M. Lustig, EECS UC Berkeley
DFT vs DTFT
• Back to moving average example:
w
![Page 20: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/20.jpg)
M. Lustig, EECS UC Berkeley
FFTSHIFT
• Note that k=0 is w=0 frequency• Use fftshift to shift the spectrum so w=0 in
the middle.
![Page 21: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/21.jpg)
M. Lustig, EECS UC Berkeley
DFT and Inverse DFT
• Both computed similarly.....let’s play:
• Also....
![Page 22: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/22.jpg)
M. Lustig, EECS UC Berkeley
DFT and Inverse DFT
• So,
or,
• Implement IDFT by:– Take complex conjugate– Take DFT– Multiply by 1/N– Take complex conjugate ! Why useful?
![Page 23: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/23.jpg)
M. Lustig, EECS UC Berkeley
DFT as Matrix Operator
DFT:
IDFT:
straightforward implementation requires N2 complex multiplies :-(
![Page 24: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/24.jpg)
M. Lustig, EECS UC Berkeley
DFT as Matrix Operator
• Can write compactly as:
• So,
as expected.WHY?
![Page 25: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/25.jpg)
M. Lustig, EECS UC Berkeley
Properties of DFT
• Inherited from DFS (EE120/20) so no need to be proved
• Linearity
• Circular Time Shift
![Page 26: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/26.jpg)
M. Lustig, EECS UC Berkeley
Circular shift
![Page 27: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/27.jpg)
M. Lustig, EECS UC Berkeley
Properties of DFT
• Circular frequency shift
• Complex Conjugation
• Conjugate Symmetry for Real Signals
Show....
![Page 28: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/28.jpg)
M. Lustig, EECS UC Berkeley
Examples
• 4-point DFT–Basis functions?–Symmetry
• 5-point DFT–Basis functions?–Symmetry
![Page 29: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/29.jpg)
Cool DSP: Phase Vocoder, used in autotune
https://www.youtube.com/watch?v=6fTh0WRJoX4
Changes the frequency and time domains of audio signals, whilestill accounting for phase information
Uses the DFT!(we’ll return to thisat the end of lecture)
![Page 30: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/30.jpg)
How can this be used in a phase vocoder?
How would you slow this music down?
https://www.youtube.com/watch?v=O3_ihwhjHUw
How about changing the pitch?Phase correlations must be respected!
Time
Frequency
![Page 31: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/31.jpg)
M. Lustig, EECS UC Berkeley
Properties of DFT
• Parseval’s Identity
• Proof (in matrix notation)
![Page 32: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/32.jpg)
M. Lustig, EECS UC Berkeley
Circular Convolution Sum
• Circular Convolution:
for two signals of length N
• Note: Circular convolution is commutative
![Page 33: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/33.jpg)
M. Lustig, EECS UC Berkeley
Properties of DFT
• Circular Convolution: Let x1[n], x2[n] be length N
• Multiplication: Let x1[n], x2[n] be length N
Very useful!!! ( for linear convolutions with DFT)
![Page 34: EE123 Digital Signal Processing - EECS Instructional ...ee123/sp15/Notes/Lecture05.pdf · EE123 Digital Signal Processing ... DFT and Inverse DFT •So, or, • Implement IDFT by:](https://reader031.vdocument.in/reader031/viewer/2022030919/5b7751de7f8b9a8f698ca81c/html5/thumbnails/34.jpg)
M. Lustig, EECS UC Berkeley
Linear Convolution
• Next....– Using DFT, circular convolution is easy – But, linear convolution is useful, not circular– So, show how to perform linear convolution
with circular convolution – Used DFT to do linear convolution