CE 40763 Digital Signal Processing Fall 1992 Discrete Fourier Transform (DFT) Hossein Sameti Department of Computer Engineering Sharif University of Technology
Motivation The DTFT is defined using an infinite sum over a discrete time signal and yields a continuous function X(ω) not very useful because the outcome cannot be stored on a PC. Now introduce the Discrete Fourier Transform (DFT), which is discrete and can be stored on a PC. We will show that the DFT yields a sampled version of the DTFT. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Review of Transforms C. C. D. C. D. Complex Inf. or Finite Int. D. periodic periodic D. finite finite Int.
Review of Transforms
Discrete Fourier Series (DFS) Decompose in terms of complex exponentials that are periodic with period N. How many exponentials? N Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Discrete Fourier Series (DFS) Exponentials that are periodic with period N. arbitrary integer 1 * Proof:
Discrete Fourier Series (DFS) How to find X(k)? Answer: Proof : substitute X(k) in the first equation. It can also easily be shown that X(k) is periodic with period N: arbitrary integer Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
DFS Pairs Analysis: Synthesis: Periodic N pt. seq. in time domain seq. in freq. domain Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Example … … Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Example (cont.) (eq.1) (eq.2) (eq.1) & (eq.2) Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Properties of DFS Shift property: Periodic convolution: Period N Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Periodic convolution - Example Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Properties of DFS In the list of properties: 𝑊 𝑁 = 𝑒 −𝑗2𝜋 𝑁 𝑊 𝑁 = 𝑒 −𝑗2𝜋 𝑁 𝑊 𝑁 𝑘𝑛 = 𝑒 𝑘 (𝑛) Where: Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Properties of DFS Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Properties of DFS Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Discrete Fourier Transform N pt. N pt. DFT N pt. N pt. DTFT DFT DFS Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Deriving DFT from DFS 1) Start with a finite-length seq. x(n) with N points (n=0,1,…, N-1). 2) Make x(n) periodic with period N to get Extracts one period of Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Deriving DFT from DFS (cont.) 3) Take DFS of 4) Take one period of to get DFT of x(n): N pt. N pt. periodic N pt. periodic N pt. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Example
Discrete Fourier Transform Definition of DFT: N pt. DFT of x(n) Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Example
Example, cont’d Mehrdad Fatourechi, Electrical and Computer Engineering, University of British Columbia, Summer 2011
Relationship between DFT and DTFT DFT thus consists of equally-spaced samples of DTFT. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Relationship between DFT and DTFT 8 pt. sequence 8 pt. DFT Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
M pt. DFT of N pt. Signal So far we calculated the N pt. DFT of a seq. x(n) with N non-zero values: Suppose we pad this N pt. seq. with (M-N) zeros to get a sequence with length M. We can now take an M-pt. DFT of the signal x(n) Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
M pt. DFT of N pt. Signal DFT N pt. M pt. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Example 4 pt. DFT: 6 pt. DFT: How are these related to each other?
M pt. DFT of N pt. Signal Going from N pt. to 2N pt. DFT Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
M pt. DFT of N pt. Signal N pt. DFT 2N pt. DFT N pt. seq. N pt. 2N pt. padded with N zeros What is the minimum number of N needed to recover x(n)? Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Problem Statement Assume y(n) is a signal of finite or infinite extent. Sample at N equally-spaced points. N pt. sequence. N pt. sequence. What is the relationship between x(n) and y(n)? What happens if N is larger , equal or less than the length of y(n)? Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Solution to the Problem Statement We start with x(n) and find its relationship with y(n): Change the order of summation: Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Solution to the Problem Statement However, we have shown that: Convolution with train of delta functions Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Solution to the Problem Statement One period of the replicated version of y(n) Examples If we sample at a sampling rate that is higher than the number of points in y(n), we should be able to recover y(n). Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Properties of DFT Shift property: N pt. seq. The above relationship is not correct, because of the definition of DFT. The signal should only be non-zero for the first N points. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Properties of DFT In the list of properties: 𝑊 𝑁 = 𝑒 𝑗2𝜋 𝑁 , 𝑊 𝑁 = 𝑒 𝑗2𝜋 𝑁 , 𝑊 𝑁 𝑘𝑛 = 𝑒 𝑘 (𝑛) where: and where: Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Summery of Properties of DFT Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Summery of Properties of DFT Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Using DFT to calculate linear convolution Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Convolution We are familiar with, “linear convolution”. Question: Can DFT be used for calculating the linear convolution? The answer is: NO! (at least not in its current format) We now examine how DFT can be applied in order to calculate linear convolution. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Definitions of convolution Linear convolution: Application in the analysis of LTI systems Periodic convolution: A seq. with period N Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Definitions of convolution(cont.) Circular convolution: N pt. seq. Circular convolution is closely related to periodic convolution. N pt. DFT of x3 N pt. DFT of x2 N pt. DFT of x1 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Example: Circular Convolution Make an N pt. seq. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Example: Circular Convolution
Circular Convolution & DFT We know from DFS properties: Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Circular Convolution & DFT If we multiply the DFTs of two N pt. sequences, we get the DFT of their circular convolution and not the DFT of their linear convolution. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Example : Circular Convolution Calculate N pt. circular convolution of x1 and x2 for the following two cases of N: N=L N=2L Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Case 1: N=L IDFT N pt. DFT of x1 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Case 1: N=L Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Case 2: N=2L Pad each signal with L extra zeros to get an 2L pt. seq.: N=2L pt. DFT of x1 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Case 2: N=2L Same as linear convolution!!
Using DFT to Calculate linear Convolution Our hypothesis is that if we pad two DT signals with enough zeros so that its length becomes N, we can use DFT to calculate linear convolution. L pt. seq. P pt. seq. Goal: calculate Using DFT Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Using DFT to Calculate linear Convolution To get DFT, we have to sample the above DTFT at N equally-spaced points: Solution to the problem statement (Eq.1) Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Using DFT to Calculate linear Convolution On the other hand, we know that: N pt. DFT of x1 N pt. DFT of x2 Circular convolution (Eq.2) (Eq.1) (Eq.2) Replicated version of the linear convolution Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Using DFT to Calculate linear Convolution In other words, the N pt. circular convolution of two DT signals is the same as their linear convolution, if we make the result of linear convolution periodic with period N and extract one period. To avoid aliasing: We can thus use DFT in order to calculate the linear convolution of two sequences! Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Algorithm for calculating linear convolution using DFT 1) Start with L pt. seq. P pt. seq. 2) Choose 3) Pad with N-L zeros to get N points. 4) Pad with N-P zeros to get N points. 5) Calculate the N pt. DFTs of the above two sequences and multiply them together. 6) Calculate IDFT of the resulting N pt. sequence. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Using DFT for linear filtering when one sequence is very long h(n) A very long sequence An FIR filter with a limited number of taps (P) Examples of this situation? Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Using DFT for linear filtering when one sequence is very long Solution to the problem Overlap - add Main idea: using the following property: Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Overlap- add method Segment the long sequence into non-overlapping chunks of data with the length of L. Convolve each chunk with h(n) to get (L+P-1) new points. Add the results of the convolution of all chunks to get the final answer. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Overlap- add method- Example Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Overlap- add method- Example Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Overlap- add method- Example Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology
Summary Discussed DFS and DFT and examined the relationship between DFT and DTFT Showed how DFT can be used for calculating convolution sum. Next: Fast Fourier Transform Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology