Top Banner
Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3
26

Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

Dec 22, 2015

Download

Documents

Dale Clark
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: Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

Lecture 12:Introduction to Discrete Fourier Transform

Sections 2.2.3, 2.3

Page 2: Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-8

-6

-4

-2

0

2

4

6

8

5*sin (24t)

Amplitude = 5

Frequency = 4 Hz

seconds

Review: A sine wave

Page 3: Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-8

-6

-4

-2

0

2

4

6

8

5*sin(24t)

Amplitude = 5

Frequency = 4 Hz

Sampling rate = 256 samples/second

seconds

Sampling duration =1 second

Review: A sine wave signal

Page 4: Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-2

-1.5

-1

-0.5

0

0.5

1

1.5

2sin(28t), SR = 8.5 Hz

Review: An undersampled signal

Page 5: Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

Review: The Nyquist Frequency

•The Nyquist frequency is equal to one-half of the sampling frequency.

•The Nyquist frequency is the highest frequency that can be measured in a signal.

Page 6: Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

The Fourier Transform

•A transform takes one function (or signal) and turns it into another function (or signal)

•Continuous Fourier Transform:close your eyes if you

don’t like integrals

Page 7: Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

•A transform takes one function (or signal) and turns it into another function (or signal)

•The Discrete Fourier Transform:

The Fourier Transform

1

0

2

1

0

2

1 N

n

Niknnk

N

k

Niknkn

eHN

h

ehH

Page 8: Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

Fast Fourier Transform•The Fast Fourier Transform (FFT) is a

very efficient algorithm for performing a discrete Fourier transform

•FFT principle first used by Gauss in 18??•FFT algorithm published by Cooley &

Tukey in 1965•In 1969, the 2048 point analysis of a

seismic trace took 13 ½ hours. Using the FFT, the same task on the same machine took 2.4 seconds!

Page 9: Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-2

-1

0

1

2

0 20 40 60 80 100 1200

50

100

150

200

250

300

Famous Fourier Transforms

Sine wave

Delta function

Page 10: Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

Famous Fourier Transforms

0 5 10 15 20 25 30 35 40 45 500

0.1

0.2

0.3

0.4

0.5

0 50 100 150 200 2500

1

2

3

4

5

6

Gaussian

Gaussian

Page 11: Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

Famous Fourier Transforms

-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1-0.5

0

0.5

1

1.5

-100 -50 0 50 1000

1

2

3

4

5

6

Sinc function

Square wave

Page 12: Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

Famous Fourier Transforms

Sinc function

Square wave

-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1-0.5

0

0.5

1

1.5

-100 -50 0 50 1000

1

2

3

4

5

6

Page 13: Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

Famous Fourier Transforms

Exponential

Lorentzian

0 50 100 150 200 2500

5

10

15

20

25

30

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 20

0.2

0.4

0.6

0.8

1

Page 14: Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

Effect of changing sample rate

0 10 20 30 40 50 600

10

20

30

40

50

60

70

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-2

-1

0

1

2

0 10 20 30 40 50 600

5

10

15

20

25

30

35

f = 8 Hz T2 = 0.5 s

Page 15: Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

Effect of changing sample rate

0 10 20 30 40 50 600

10

20

30

40

50

60

70

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-2

-1

0

1

2

0 10 20 30 40 50 600

5

10

15

20

25

30

35

SR = 256 HzSR = 128 Hz

f = 8 HzT2 = 0.5 s

Page 16: Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

Effect of changing sample rate

•Lowering the sample rate:▫Reduces the Nyquist frequency, which▫Reduces the maximum measurable

frequency▫Does not affect the frequency resolution

Page 17: Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

Effect of changing sampling duration

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-2

-1

0

1

2

0 2 4 6 8 10 12 14 16 18 200

10

20

30

40

50

60

70

f = 8 Hz T2 = .5 s

Page 18: Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

Effect of changing sampling duration

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-2

-1

0

1

2

0 2 4 6 8 10 12 14 16 18 200

10

20

30

40

50

60

70

ST = 2.0 sST = 1.0 s

f = 8 HzT2 = .5 s

Page 19: Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

Effect of changing sampling duration

•Reducing the sampling duration:▫Lowers the frequency resolution▫Does not affect the range of frequencies

you can measure

Page 20: Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

Effect of changing sampling duration

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-2

-1

0

1

2

0 2 4 6 8 10 12 14 16 18 200

50

100

150

200

f = 8 Hz T2 = 2.0 s

Page 21: Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

Effect of changing sampling duration

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-2

-1

0

1

2

0 2 4 6 8 10 12 14 16 18 200

2

4

6

8

10

12

14

ST = 2.0 sST = 1.0 s

f = 8 Hz T2 = 0.1 s

Page 22: Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

Measuring multiple frequencies

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-3

-2

-1

0

1

2

3

0 20 40 60 80 100 1200

20

40

60

80

100

120

f1 = 80 Hz, T21 = 1 s

f2 = 90 Hz, T22 = .5 s

f3 = 100 Hz, T2

3 = 0.25 s

SR = 256 Hz

Page 23: Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

Measuring multiple frequencies

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-3

-2

-1

0

1

2

3

0 20 40 60 80 100 1200

20

40

60

80

100

120

f1 = 80 Hz, T21 = 1 s

f2 = 90 Hz, T22 = .5 s

f3 = 200 Hz, T2

3 = 0.25 s

SR = 256 Hz

Page 24: Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

FFT in matlab• Assign your time variables

▫ t = [0:255];• Assign your function

▫ y = cos(2*pi*n/10);• Choose the number of points for the FFT (preferably a power of two)

▫ N = 2048;• Use the command ‘fft’ to compute the N-point FFT for your signal

▫ Yf = abs(fft(y,N)); • Use the ‘fftshift’ command to shift the zero-frequency component to

center of spectrum for better visualization of your signals spectrum▫ Yf= fftshift(Yf);

• Assign your frequency variable which is your x-axis for the spectrum▫ f = [-N/2:N/2-1]/N; - this is the normalized frequency symmetrical

about f0 and about the y-axis

• Plot the spectrum▫ plot(f, Yf)

Page 25: Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

FFT in matlab• Vary the sampling frequency and see what happens• Vary the sample duration and see what happens

Page 26: Lecture 12: Introduction to Discrete Fourier Transform Sections 2.2.3, 2.3.

Spectrum of a signal

-0.5 -0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4 0.50

10

20

30

40

50

60

70

80

frequency / f s

Approximate Spectrum of a Sinusoid with the FFT