Top Banner
Finite Length Discrete Fourier Transform Discrete Fourier Transform (DFT) Usually, we do not have an infinite amount of data which is required by the DTFT. Instead, we have 1 image, a segment of speech, etc. Also, most real- world data are not of the convenient form a n u[n]. Finally, on a computer, we can not calculate an uncountably infinite (continuum) of frequencies as required by the DTFT. ACTUAL DATA ANALYSIS on a computer- Use a DFT to look at a finite segment of data. In our development in the previous section of x[n] periodic with x 0 [n] the part of the signal that was repeated, we could have assumed that our finite segment of data came from “windowing” an infinite length sequence x[n] x 0 [n]= x[n]w R [n] where w R [n] is a rectangular window: 1
23

Finite Length Discrete Fourier Transformcircuit.ucsd.edu/.../ece161a/161a/Lecture_Notes_files/NOTES_DFT_1.pdf · Finite Length Discrete Fourier Transform Discrete Fourier Transform

Apr 23, 2018

Download

Documents

dodieu
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Finite Length Discrete Fourier Transformcircuit.ucsd.edu/.../ece161a/161a/Lecture_Notes_files/NOTES_DFT_1.pdf · Finite Length Discrete Fourier Transform Discrete Fourier Transform

Finite Length Discrete FourierTransform

Discrete Fourier Transform (DFT)

Usually, we do not have an infinite amount of data which is required by theDTFT. Instead, we have 1 image, a segment of speech, etc. Also, most real-world data are not of the convenient form anu[n].

Finally, on a computer, we can not calculate an uncountably infinite(continuum) of frequencies as required by the DTFT.

ACTUAL DATA ANALYSIS on a computer- Use a DFT to look at afinite segment of data.

In our development in the previous section of x[n] periodic with x0[n] thepart of the signal that was repeated, we could have assumed that our finitesegment of data came from “windowing” an infinite length sequence x[n]

x0[n] = x[n]wR[n]

where wR[n] is a rectangular window:

1

Page 2: Finite Length Discrete Fourier Transformcircuit.ucsd.edu/.../ece161a/161a/Lecture_Notes_files/NOTES_DFT_1.pdf · Finite Length Discrete Fourier Transform Discrete Fourier Transform

wR[n] =

!1, n = 0, 1, · · · , N − 10, otherwise

x0[n] = x[n]wR[n] is just the samples of x[n] between n = 0 and n = N − 1.x0[n] is 0 everywhere else. Therefore, it is defined ∀n, and we can take itsDTFT:

X0(Ω) = DTFT(x0[n]) =∞"

n=−∞x0[n]e

−jΩn =∞"

n=−∞x[n]wR[n]e

−jΩn =N−1"

n=0

x[n]e−jΩn

So,

X0(Ω) =N−1"

n=0

x[n]e−jΩn =N−1"

n=0

x0[n]e−jΩn

as we saw before.

Let’s say now that we want to sample X0(Ω) (which is continuous andperiodic with period 2π) so we store it on a computer.

Sample X0(Ω):Assume we want 8 points in frequency – then sampleX0(Ω) at 8 uniformly

spaced points on the unit circle:

Values of frequency are 0, π/4, π/2, · · · , 7π/4 or 2πk/8, k = 0, 1, · · · , 7.

2

Page 3: Finite Length Discrete Fourier Transformcircuit.ucsd.edu/.../ece161a/161a/Lecture_Notes_files/NOTES_DFT_1.pdf · Finite Length Discrete Fourier Transform Discrete Fourier Transform

If we let k = N , what happens? If k = N , we get repetition of the pointswe sampled so only N samples are unique.

Define Discrete Fourier Transform (DFT) as

X[k] = X0(2πk

N)

for Ω = 2πkN , k = 0, 1, . . . , N − 1, i.e. only look at the N distinct sampled

frequencies of X0(Ω).

Significant Observations

1. The resolution of the samples of the frequency spectrum is 2πN since we

sample the spectrum at points that are spaced 2πN apart in frequency,

that is, ∆Ω = 2πN .

2. If we looked at the samples of X0(Ω) for all k = −∞ to ∞ for frequen-cies 2πk

N , we would get the closely related Discrete Fourier Series (DFS)which is of course periodic with period N since X0(Ω) is periodic.

3. If x is a periodic signal with period N , as we saw that DFS was suf-ficient to construct the DTFT of the signal. In other words, the DFTprocedure approximates a signal with a periodic approximation of itself.

Now

X [k] = X0(Ω)|Ω =2πk

N, k = 0, 1, · · · , N − 1

=N−1"

n=0

x[n]e−jΩn|Ω= 2πkN ,k=0,1,···,N−1

=N−1"

n=0

x[n]e−j 2πknN , k = 0, 1, · · · , N − 1

Shorthand Notation for the DFT:Let WN = e−j 2π

N ⇒ N th root of unity (WNN = 1) since WN

N = e−j2π = 1.You may also write WN simply as W .

Then

X[k] =N−1"

n=0

x[n]W knN , k = 0, 1, · · · , N − 1

is the DFT of your windowed sequence x0[n].

3

Page 4: Finite Length Discrete Fourier Transformcircuit.ucsd.edu/.../ece161a/161a/Lecture_Notes_files/NOTES_DFT_1.pdf · Finite Length Discrete Fourier Transform Discrete Fourier Transform

Ex.Find

N−1"

n=0

(e−j2πk

N )n =N−1"

n=0

W kn

This is just the DFT of x[n] = 1, n = 0, 1, · · · , 7.

4

Page 5: Finite Length Discrete Fourier Transformcircuit.ucsd.edu/.../ece161a/161a/Lecture_Notes_files/NOTES_DFT_1.pdf · Finite Length Discrete Fourier Transform Discrete Fourier Transform

Ex.

x[n] =

!1, n = 00, n = 1, . . . , 7

Find X [k], k = 0, 1, . . . , 7.

5

Page 6: Finite Length Discrete Fourier Transformcircuit.ucsd.edu/.../ece161a/161a/Lecture_Notes_files/NOTES_DFT_1.pdf · Finite Length Discrete Fourier Transform Discrete Fourier Transform

Given y[n] = δ[n− 2] and N = 8, find Y [k].

6

Page 7: Finite Length Discrete Fourier Transformcircuit.ucsd.edu/.../ece161a/161a/Lecture_Notes_files/NOTES_DFT_1.pdf · Finite Length Discrete Fourier Transform Discrete Fourier Transform

Ex. x[n] = cW−pnN , n = 0, 1, . . . , N − 1,

p is an integer with p ∈ [0, 1, . . . , N − 1] and WN = e−j 2πN (as usual), find

its DFT.

7

Page 8: Finite Length Discrete Fourier Transformcircuit.ucsd.edu/.../ece161a/161a/Lecture_Notes_files/NOTES_DFT_1.pdf · Finite Length Discrete Fourier Transform Discrete Fourier Transform

Synthesis: INVERSE DFTHow can we recover x[n] from X [k]?Synthesis formula is

x[n] =1

N

N−1"

k=0

X [k]W−knN , n = 0, 1, . . . , N − 1

Prove this gives back x[n]:

x[n] =1

N

N−1"

k=0

N−1"

l=0

x[l]W klN W−kn

N

=1

N

N−1"

l=0

x[l]N−1"

k=0

W k(l−n)N

Ex.

N−1"

k=0

W k(l−n)N =?

8

Page 9: Finite Length Discrete Fourier Transformcircuit.ucsd.edu/.../ece161a/161a/Lecture_Notes_files/NOTES_DFT_1.pdf · Finite Length Discrete Fourier Transform Discrete Fourier Transform

ORTHOGONALITY OF EXPONENTIALS AGAIN!So,

N−1"

k=0

W k(l−n)N =

!N, l = n0, l = n

and

x[n] =1

N

N−1"

l=0

x[l]N−1"

k=0

W k(l−n)N =

1

N

N−1"

l=0

x[l]Nδ[n − l]

=1

N(Nx[n]) = x[n]

Ex. Find the IDFT of X [k] = 1, k = 0, 1, . . . , 7.

9

Page 10: Finite Length Discrete Fourier Transformcircuit.ucsd.edu/.../ece161a/161a/Lecture_Notes_files/NOTES_DFT_1.pdf · Finite Length Discrete Fourier Transform Discrete Fourier Transform

Ex. Given x[n] = δ[n] + 2δ[n− 1] + 3δ[n− 2] + δ[n− 3] and N = 4, findX [k].

10

Page 11: Finite Length Discrete Fourier Transformcircuit.ucsd.edu/.../ece161a/161a/Lecture_Notes_files/NOTES_DFT_1.pdf · Finite Length Discrete Fourier Transform Discrete Fourier Transform

Ex. Given X [k] = 2δ[k] + 2δ[k − 2] and N = 4, find x[n].

11

Page 12: Finite Length Discrete Fourier Transformcircuit.ucsd.edu/.../ece161a/161a/Lecture_Notes_files/NOTES_DFT_1.pdf · Finite Length Discrete Fourier Transform Discrete Fourier Transform

Selected DFT Properties

1. Linearity.

ax1[n] + bx2[n] ↔ aX1[k] + bX2[k]

2. Time shift.

x[n− n0]mod N ↔ W kn0N X [k]

3. Frequency shift.

W−nk0N x[n] ↔ X [k − k0]mod N

4. Multiplication.

x1[n]x2[n] ↔1

NX1[k]⊗X2[k]

5. Circular convolution.

x1[n]⊗ x2[n] ↔ X1[k]X2[k]

6. Real/Even.

x[n] = xe[n] + xo[n] ↔ X [k] = A[k] + jB[k]

xe[n] ↔ A[k]

xo[n] ↔ jB[k]

If x[n] is real, thenX [−k]mod N = X∗[k].

If x[n] is even, then X [k] is real. (For a finite length function to beeven, x[n] = x[−n]mod N)

12

Page 13: Finite Length Discrete Fourier Transformcircuit.ucsd.edu/.../ece161a/161a/Lecture_Notes_files/NOTES_DFT_1.pdf · Finite Length Discrete Fourier Transform Discrete Fourier Transform

Fast Fourier Transform

The work of Cooley and Tukey showed how to calculate the DFT with com-plexity N logN (called the Fast Fourier Transform) instead of complexityN2 using the direct algorithm. The fft command that you use in MATLABimplements a Fast Fourier Transform.

Examine:

X [k] =N−1"

n=0

x[n]W kn

There are approximately N2 complex multiplications and additions re-quired to implement this (N for each value of X [k]).

If N = 210 = 1024, then N2 = 220 = 106, a very large number!

However, the FFT would only require about 5000, a substantial savingsin complexity (the actual calculation is N

2 log2N).

There are a number of different FFT algorithms that exist includingdecimation-in-time and decimation-in-frequency.

The primary idea is to split up the size-N DFT into N2 DFTs of length 2

each.

You split the sum into 2 subsequences of length N2 and continue all the

way down until you have N2 subsequences of length 2.

13

Page 14: Finite Length Discrete Fourier Transformcircuit.ucsd.edu/.../ece161a/161a/Lecture_Notes_files/NOTES_DFT_1.pdf · Finite Length Discrete Fourier Transform Discrete Fourier Transform

First break x[n] into even and odd subsequences:

X [k] ="

neven

x[n]W kn +"

nodd

x[n]W kn

Now let n = 2m for even numbers and n = 2m+ 1 for odd numbers:

X [k] =

N2 −1"

m=0

x[2m]W 2mk +

N2 −1"

m=0

x[2m+ 1]W k(2m+1) =

N2 −1"

m=0

x[2m](W 2)mk +W k

N2 −1"

m=0

x[2m+ 1](W 2)mk =

Xe[k] +W kXo[k]

Xe[k] and Xo[k] are both the DFT of a N2 point sequence.

W k is often referred to as the “twiddle factor.”

Now break up the size N2 subsequences in half by letting m = 2p:

Xe[k] =

N4 −1"

p=0

x[4p](W 4)kp +W 2k

N4 −1"

p=0

x[4p+ 2](W 4)kp =

The first subsequence here is the terms x[0], x[4], . . . and the second isx[2], x[6], . . . .

14

Page 15: Finite Length Discrete Fourier Transformcircuit.ucsd.edu/.../ece161a/161a/Lecture_Notes_files/NOTES_DFT_1.pdf · Finite Length Discrete Fourier Transform Discrete Fourier Transform

Also, we have that:

WN2

N = −1

Y [k] =1"

n=0

y[n]W kn2 = y[0] +W k

2 y[1]

W2 = e−j2π2 = e−jπ = −1

So we get,

Y [k] = y[0] + (−1)ky[1]

and:

Y [0] = y[0] + y[1]

Y [1] = y[0]− y[1]

15

Page 16: Finite Length Discrete Fourier Transformcircuit.ucsd.edu/.../ece161a/161a/Lecture_Notes_files/NOTES_DFT_1.pdf · Finite Length Discrete Fourier Transform Discrete Fourier Transform

Ex.This was a problem I had on a DSP final exam in 1984:Express the DFT of the 9-point sequence x[0], x[1], . . . , x[8] in terms of

the DFTs of 3-point sequences x[0], x[3], x[6], x[1], x[4], x[7], and x[2], x[5], x[8]

We start with:

X [k] =2"

m=0

x[3m]W 3mk9 +

2"

m=0

x[3m+ 1]W (3m+1)k9 +

2"

m=0

x[3m+ 2]W (3m+2)k9

16

Page 17: Finite Length Discrete Fourier Transformcircuit.ucsd.edu/.../ece161a/161a/Lecture_Notes_files/NOTES_DFT_1.pdf · Finite Length Discrete Fourier Transform Discrete Fourier Transform

Applications of the DFT

Linear ConvolutionYou can use an FFT in MATLAB to compute linear convolution. If you

don’t use a sufficient number of points in the DFT, you will get overlap.

CIRCULAR CONVOLUTIONSince DFTs are a limited length sequence, convolution is done mod N ⇒

circular convolution.

x1[n]⊗ x2[n] =N−1"

p=0

x1[p]x2[n− p]mod N

That is, when we flip and shift the sequence x2[n], we do it mod N .

Also, note that:

x1[n]⊗ x2[n] ↔ X1[k]X2[k]

17

Page 18: Finite Length Discrete Fourier Transformcircuit.ucsd.edu/.../ece161a/161a/Lecture_Notes_files/NOTES_DFT_1.pdf · Finite Length Discrete Fourier Transform Discrete Fourier Transform
Page 19: Finite Length Discrete Fourier Transformcircuit.ucsd.edu/.../ece161a/161a/Lecture_Notes_files/NOTES_DFT_1.pdf · Finite Length Discrete Fourier Transform Discrete Fourier Transform

Ex. Find x1[n]⊗ x2[n] = z[n].

18

Page 20: Finite Length Discrete Fourier Transformcircuit.ucsd.edu/.../ece161a/161a/Lecture_Notes_files/NOTES_DFT_1.pdf · Finite Length Discrete Fourier Transform Discrete Fourier Transform

Ex. N = 8, find x1[n]⊗ x2[n] = y[n].

19

Page 21: Finite Length Discrete Fourier Transformcircuit.ucsd.edu/.../ece161a/161a/Lecture_Notes_files/NOTES_DFT_1.pdf · Finite Length Discrete Fourier Transform Discrete Fourier Transform

Ex. Find y[n] = x[n]⊗ x[n].

20

Page 22: Finite Length Discrete Fourier Transformcircuit.ucsd.edu/.../ece161a/161a/Lecture_Notes_files/NOTES_DFT_1.pdf · Finite Length Discrete Fourier Transform Discrete Fourier Transform

Overview of Chapters 3, 4, and 5Fourier Analysis for Discrete-Time Signals

1. DTFT for infinite length sequences:

continuous frequency, periodic with period 2π,

X(Ω) ="

n

x[n]e−jΩn

Important: DT convolution ↔ multiplication of DTFTs.

Inverse system:

h[n] ∗ hi[n] = δ[n] ↔ H(Ω)Hi(Ω) = 1

2. DTFT of a periodic DT sequence by allowing impulses in frequency:

x[n] ="

k

akejΩkn ↔ 2π

"

k

akδ(Ω− Ωk)

where

ak = X0(2πk

N)

3. DFT for a finite length data

discrete frequency

Take DTFT of windowed infinite length sequence and then sample atdiscrete frequencies,

Ω =2πk

N, k = 0, 1, . . . , N − 1

N discrete frequencies since exponential is periodic.

X[k] =N−1"

n=0

x[n]e−j 2πknN =

N−1"

n=0

x[n]W knN

Orthogonality of Exponentials:

N−1"

n=0

W knN = Nδ[k]

21

Page 23: Finite Length Discrete Fourier Transformcircuit.ucsd.edu/.../ece161a/161a/Lecture_Notes_files/NOTES_DFT_1.pdf · Finite Length Discrete Fourier Transform Discrete Fourier Transform