EE123 Discussion Section 3 - University of California ...
Transcript of EE123 Discussion Section 3 - University of California ...
RecapProblems
EE123 Discussion Section 3
Jon Tamir (based on slides by Frank Ong)
February 8, 2016
Jon Tamir EE123 Discussion Section 3
RecapProblems
Announcements
I Submit Lab 1 by Thursday, Feb. 11 on bCourses
I Submit Homework 2 self-grade by Friday, Feb. 12 on bCourses
I Submit Homework 3 by Friday, Feb. 12 on bCourses
I Midterm 1 on Monday, Feb. 22 in class (2 hours)
Jon Tamir EE123 Discussion Section 3
RecapProblems
Plan
I DFT problems
I DCT demo and problem
I FFT demo
Jon Tamir EE123 Discussion Section 3
RecapProblems
The Discrete Fourier Transform
X [k] =N−1∑n=0
x [n]W knN [Analysis]
x [n] =1
N
N−1∑n=0
X [k]W−knN [Synthesis]
Equivalent interpretations of the DFT:
I Sampling the DTFT at ω = 2πN k
I The DTFT of periodically extended signalI Sampling the z-transform at z = e j
2πN k
I Direct implementation: O(N2)
I Fast implementation: O(N logN)
Jon Tamir EE123 Discussion Section 3
RecapProblems
The Discrete Fourier Transform
X [k] =N−1∑n=0
x [n]W knN [Analysis]
x [n] =1
N
N−1∑n=0
X [k]W−knN [Synthesis]
Equivalent interpretations of the DFT:
I Sampling the DTFT at ω = 2πN k
I The DTFT of periodically extended signalI Sampling the z-transform at z = e j
2πN k
I Direct implementation: O(N2)
I Fast implementation: O(N logN)
Jon Tamir EE123 Discussion Section 3
RecapProblems
The Discrete Fourier Transform
X [k] =N−1∑n=0
x [n]W knN [Analysis]
x [n] =1
N
N−1∑n=0
X [k]W−knN [Synthesis]
Equivalent interpretations of the DFT:
I Sampling the DTFT at ω = 2πN k
I The DTFT of periodically extended signalI Sampling the z-transform at z = e j
2πN k
I Direct implementation: O(N2)
I Fast implementation: O(N logN)
Jon Tamir EE123 Discussion Section 3
RecapProblems
The Discrete Fourier Transform
Jon Tamir EE123 Discussion Section 3
RecapProblems
Question 1
Given a 10-point sequence x [n], we wish to find equally spacedsamples of its Z transform X (z) on the contour as shown. Showhow to achieve this using the DFT.
π210
π220
Circle withradius = 1/2
���
���
����
����
���
���
������
������
������
������
������
������
���
���
������
������
������
������
Im
Re
z-plane
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 1
π210
π220
Circle withradius = 1/2
���
���
����
����
���
���
������
������
������
������
������
������
���
���
������
������
������
������
Im
Re
z-plane
I Want to find X (z)|z= 12e j(2πk/10+π/10)
I X (z)|z= 12e j(2πk/10+π/10) =
∑n x [n]0.5−ne−j πn
10 e−j 2πkn10
I =⇒ DFT{x [n]0.5−ne−j πn10 }
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 1
π210
π220
Circle withradius = 1/2
���
���
����
����
���
���
������
������
������
������
������
������
���
���
������
������
������
������
Im
Re
z-plane
I Want to find X (z)|z= 12e j(2πk/10+π/10)
I X (z)|z= 12e j(2πk/10+π/10) =
∑n x [n]0.5−ne−j πn
10 e−j 2πkn10
I =⇒ DFT{x [n]0.5−ne−j πn10 }
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 1
π210
π220
Circle withradius = 1/2
���
���
����
����
���
���
������
������
������
������
������
������
���
���
������
������
������
������
Im
Re
z-plane
I Want to find X (z)|z= 12e j(2πk/10+π/10)
I X (z)|z= 12e j(2πk/10+π/10) =
∑n x [n]0.5−ne−j πn
10 e−j 2πkn10
I =⇒ DFT{x [n]0.5−ne−j πn10 }
Jon Tamir EE123 Discussion Section 3
RecapProblems
Question 2
x [n] = {−3, 5, 4,−1,−9,−6,−8, 2}
I a) Evaluate∑7
k=0(−1)kX [k]
I b) Evaluate∑7
k=0 |X [k]|2
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 2
I part a)
(−1)k = e−jπk = e−j 2π4k8 = W 4k
8
x [4] =1
8
7∑k=0
X [k]W 4k8
⇒7∑
k=0
(−1)kX [k] = 8x [4] = −72
I part b) By Parseval’s Theorem,∑7k=0 |X [k]|2 = 8
∑7n=0 |x [n]|2 = 1888.
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 2
I part a)
(−1)k = e−jπk = e−j 2π4k8 = W 4k
8
x [4] =1
8
7∑k=0
X [k]W 4k8
⇒7∑
k=0
(−1)kX [k] = 8x [4] = −72
I part b) By Parseval’s Theorem,∑7k=0 |X [k]|2 = 8
∑7n=0 |x [n]|2 = 1888.
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 2
I part a)
(−1)k = e−jπk = e−j 2π4k8 = W 4k
8
x [4] =1
8
7∑k=0
X [k]W 4k8
⇒7∑
k=0
(−1)kX [k] = 8x [4] = −72
I part b) By Parseval’s Theorem,∑7k=0 |X [k]|2 = 8
∑7n=0 |x [n]|2 = 1888.
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 2
I part a)
(−1)k = e−jπk = e−j 2π4k8 = W 4k
8
x [4] =1
8
7∑k=0
X [k]W 4k8
⇒7∑
k=0
(−1)kX [k] = 8x [4] = −72
I part b) By Parseval’s Theorem,∑7k=0 |X [k]|2 = 8
∑7n=0 |x [n]|2 = 1888.
Jon Tamir EE123 Discussion Section 3
RecapProblems
Question 3
X [k] is the 9-point DFT of x [n]
I Given:
X [0] = −j ,X [2] = 1−j ,X [3] = 2−j ,X [5] = 3−j ,X [8] = 4−j
If possible, determine the remaining 4 samples with thefollowing assumptions:
I a) x [n] is real
I b) x [n] is conjugate symmetric
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 3
I a) x [n] is real, then X [k] is conjugate symmetric:
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 3
I a) x [n] is real, then X [k] is conjugate symmetric:
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 3
I a) x [n] is real, then X [k] is conjugate symmetric:
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 3
I a) x [n] is real, then X [k] is conjugate symmetric:
X [1] = X ∗[9−1] = 4+j ,X [4] = 3+j ,X [6] = 2+j ,X [7] = 1+j
BUT we also need X [0] = X ∗[0]. Clearly X [0] is not real, sothis first condition cannot be met.Not Possible.
I b) x [n] is conjugate symmetric, then X [k] is real. BUT this isnot the case.Not possible
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 3
I a) x [n] is real, then X [k] is conjugate symmetric:
X [1] = X ∗[9−1] = 4+j ,X [4] = 3+j ,X [6] = 2+j ,X [7] = 1+j
BUT we also need X [0] = X ∗[0]. Clearly X [0] is not real, sothis first condition cannot be met.Not Possible.
I b) x [n] is conjugate symmetric, then X [k] is real. BUT this isnot the case.Not possible
Jon Tamir EE123 Discussion Section 3
RecapProblems
Question 4
Let x [n] be some length-N sequence. Let X [k] = DFT{x [n]}I Express x2[n] = DFT{X [k]} in terms of x[n]
I Hint: Try to match DFT{X [k]} with the equation
x [n] =1
N
N−1∑k=0
X [k]W−knN
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 4
x2[n] = DFT{X [k]}
=N−1∑k=0
X [k]W knN
=N−1∑k=0
(X [−k])NW−knN
= 8IDFT{(X [−k])N}= 8(x [−n])N
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 4
x2[n] = DFT{X [k]}
=N−1∑k=0
X [k]W knN
=N−1∑k=0
(X [−k])NW−knN
= 8IDFT{(X [−k])N}= 8(x [−n])N
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 4
x2[n] = DFT{X [k]}
=N−1∑k=0
X [k]W knN
=N−1∑k=0
(X [−k])NW−knN
= 8IDFT{(X [−k])N}= 8(x [−n])N
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 4
x2[n] = DFT{X [k]}
=N−1∑k=0
X [k]W knN
=N−1∑k=0
(X [−k])NW−knN
= 8IDFT{(X [−k])N}
= 8(x [−n])N
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 4
x2[n] = DFT{X [k]}
=N−1∑k=0
X [k]W knN
=N−1∑k=0
(X [−k])NW−knN
= 8IDFT{(X [−k])N}= 8(x [−n])N
Jon Tamir EE123 Discussion Section 3
RecapProblems
Question 5
Let x [n] be some length-N sequence. Let X [k] = DFT{x [n]}I Express x3[k] = DFT{DFT{X [k]}} in terms of X[k]
I Express x4[n] = DFT{DFT{DFT{X [k]}}} in terms of x[n]
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 5
I Using the DFT properties:
x2[n] = 8(x [−n])N
x3[k] = DFT{x2[n]} = 8(X [−k])N
x4[n] = DFT{x3[n]} = 64x [n]
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 5 continued
I Ignoring the scaling factors:
x0[n] = DFT 0{x [n]} = x [n]
x1[k] = DFT 1{x [n]} = X [k]
x2[n] = DFT 2{x [n]} = (x [−n])N
x3[k] = DFT 3{x [n]} = (X [−k])N
x4[n] = DFT 4{x [n]} = x [n]
I The usual DFT operator is four-periodic. The nth power ofthe Fourier transform can be generalized as the fractionalFourier transform, which is used in optics.
Jon Tamir EE123 Discussion Section 3
RecapProblems
Question 6: DCT
I The Discrete Cosine Transform (DCT) is a DFT-relatedtransform that decomposes a finite signal in terms of a sum ofcosine functions
I The DCT is often used in compression schemes, such as MP3,JPEG and MPEG.
I One of the reasons is its energy compactness
Jon Tamir EE123 Discussion Section 3
RecapProblems
DCT Demo
I DCT Demo
Jon Tamir EE123 Discussion Section 3
RecapProblems
Question 6: DCT
Wanting to know more why DCT performs much better thanDFT, you decide to look closer at the definition of DCT
Given that the definition of the DCT (Type 2) is
Xc [k] = 2N−1∑n=0
x [n] cos(πk(2n + 1)
2N)
Express Xc [k] in terms of X [k], the 2N-point DFT of x [n]
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 6: DCT
Xc [k] = 2N−1∑n=0
x [n] cos(πk(2n + 1)
2N)
=N−1∑n=0
x [n](e−j πk(2n+1)2N + e j
πk(2n+1)2N )
=N−1∑n=0
x [n]e−j 2πkn2N e−j πk
2N +N−1∑n=0
x [n]e j2πkn2N e j
πk2N
= X [k]e−j πk2N + X [−k]e j
πk2N
= X [k]e−j πk2N + X ∗[k]e j
πk2N
= 2Real(X [k]e−j πk2N )
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 6: DCT
Xc [k] = 2N−1∑n=0
x [n] cos(πk(2n + 1)
2N)
=N−1∑n=0
x [n](e−j πk(2n+1)2N + e j
πk(2n+1)2N )
=N−1∑n=0
x [n]e−j 2πkn2N e−j πk
2N +N−1∑n=0
x [n]e j2πkn2N e j
πk2N
= X [k]e−j πk2N + X [−k]e j
πk2N
= X [k]e−j πk2N + X ∗[k]e j
πk2N
= 2Real(X [k]e−j πk2N )
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 6: DCT
Xc [k] = 2N−1∑n=0
x [n] cos(πk(2n + 1)
2N)
=N−1∑n=0
x [n](e−j πk(2n+1)2N + e j
πk(2n+1)2N )
=N−1∑n=0
x [n]e−j 2πkn2N e−j πk
2N +N−1∑n=0
x [n]e j2πkn2N e j
πk2N
= X [k]e−j πk2N + X [−k]e j
πk2N
= X [k]e−j πk2N + X ∗[k]e j
πk2N
= 2Real(X [k]e−j πk2N )
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 6: DCT
Xc [k] = 2N−1∑n=0
x [n] cos(πk(2n + 1)
2N)
=N−1∑n=0
x [n](e−j πk(2n+1)2N + e j
πk(2n+1)2N )
=N−1∑n=0
x [n]e−j 2πkn2N e−j πk
2N +N−1∑n=0
x [n]e j2πkn2N e j
πk2N
= X [k]e−j πk2N + X [−k]e j
πk2N
= X [k]e−j πk2N + X ∗[k]e j
πk2N
= 2Real(X [k]e−j πk2N )
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 6: DCT
Xc [k] = 2N−1∑n=0
x [n] cos(πk(2n + 1)
2N)
=N−1∑n=0
x [n](e−j πk(2n+1)2N + e j
πk(2n+1)2N )
=N−1∑n=0
x [n]e−j 2πkn2N e−j πk
2N +N−1∑n=0
x [n]e j2πkn2N e j
πk2N
= X [k]e−j πk2N + X [−k]e j
πk2N
= X [k]e−j πk2N + X ∗[k]e j
πk2N
= 2Real(X [k]e−j πk2N )
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 6: DCT
Xc [k] = 2N−1∑n=0
x [n] cos(πk(2n + 1)
2N)
=N−1∑n=0
x [n](e−j πk(2n+1)2N + e j
πk(2n+1)2N )
=N−1∑n=0
x [n]e−j 2πkn2N e−j πk
2N +N−1∑n=0
x [n]e j2πkn2N e j
πk2N
= X [k]e−j πk2N + X [−k]e j
πk2N
= X [k]e−j πk2N + X ∗[k]e j
πk2N
= 2Real(X [k]e−j πk2N )
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 6: DCT
Key point is:
Xc [k] = X [k]e−j πk2N + X [−k]e j
πk2N
Xc [k] = e−j πk2N (X [k] + X [−k]e j
2πk2N )
xc [n] = Shift 12{x [((n))2N ] + x [((−n − 1))2N ]}
Jon Tamir EE123 Discussion Section 3
RecapProblems
Solution 6: DCT
N
Periodicity assumed by DFT
N
Periodicity assumed by DCT
DCT symmetric extension is better because sharp transitionsrequire many coefficients to represent
Jon Tamir EE123 Discussion Section 3
RecapProblems
FFT Demo
I FFT Demo
Jon Tamir EE123 Discussion Section 3