dft analysis (5b) · 2013-02-12  · version 1.2 or any later version published by the free...

26
Young Won Lim 2/12/13 DFT Analysis (5B)

Upload: others

Post on 20-Sep-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: DFT Analysis (5B) · 2013-02-12  · Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover

Young Won Lim2/12/13

DFT Analysis (5B)

Page 2: DFT Analysis (5B) · 2013-02-12  · Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover

Young Won Lim2/12/13

Copyright (c) 2009, 2010, 2011 Young W. Lim.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".

Please send corrections (or suggestions) to [email protected].

This document was produced by using OpenOffice and Octave.

Page 3: DFT Analysis (5B) · 2013-02-12  · Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover

5B DFT Analysis 3 Young Won Lim2/12/13

Frequency View of a DFT Matrix

N2− 1

N2− 1

f = −1∗ f o

f = −2∗ f o

f = − N2 − 1∗ f o

f = − N2 ∗ f o

f = 1∗ f o

f = 2∗ f o

f = N2 − 1∗ f o

(−1 cycle)(−2 cycles)

f = 0

(−( N2−1)cycles)

N2−1 cycles

N2 cycles

2cycles1cycle

0cycle −1N−2N

−12

1N

−12

1N

2N

12 −

1N

0 Normalized Frequency

f o =f s

N

row 1row 2

row N2−1

row N2

row N − 1

row N − 2

row N2 1

row 0

Page 4: DFT Analysis (5B) · 2013-02-12  · Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover

5B DFT Analysis 4 Young Won Lim2/12/13

Frequency View of a X[i] Vector

N2− 1

N2− 1

f = 1∗ f o

f = 2∗ f o

f = N2 − 1 ∗ f o

f = N2 ∗ f o

f = −1∗ f o

f = −2∗ f o

f = − N2 − 1 ∗ f o

f = 0

Nor

mal

ized

Fre

quen

cy X [0 ]

X [1]X [2]

X [ N2 ]

X [ N2−1]

X [ N21]

X [N−2 ]

X [N−1]

1N f s2N f s

N2 − 1

N f s12 f s

− 1N f s

− 2N f s

− N2 − 1

N f s

01N2N

12 −

1N

12

−1N

−2N

−12

1N

01cycle2cycles

N2−1 cycles

(−( N2−1)cycles)

N2 cycles

(−2 cycles)(−1 cycle)

0cycle

Page 5: DFT Analysis (5B) · 2013-02-12  · Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover

5B DFT Analysis 5 Young Won Lim2/12/13

=

=

4-pt DFT

8-pt DFT

Δ t1 = τ

T = 4

Δ t2 = τ/2

T = 4 τ

Δ f 1 =f s1

4= 1

4 τ

Frequency and Time Interval (1)

Freq Domain Time Domain

f s1 =1τ

f s2 =2τ

f h1 =f s1

2= 1

2 τ

f h2 =f s2

2= 1τ

Δ f 2 =f s2

8= 1

4 τ

The same frequency resolution

Page 6: DFT Analysis (5B) · 2013-02-12  · Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover

5B DFT Analysis 6 Young Won Lim2/12/13

=8-pt DFT

2T = 8 τ

Δ t3 = τ

f s3 =1τ

Δ f 3 =f s3

8= 1

8 τ

f h3 =f s3

2= 1

2 τ

Frequency and Time Interval (2)

The finer frequency resolution

Repeating the time signal two times

Page 7: DFT Analysis (5B) · 2013-02-12  · Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover

5B DFT Analysis 7 Young Won Lim2/12/13

=8-pt DFT

2T = 8

Δ t 4 = τ

f s4 =1τ

Δ f 4 =f s4

8= 1

8 τ

f h4 =f s4

2= 1

2 τ

Frequency and Time Interval (3)

The finer frequency resolution

Use two times more samples (2T)

Page 8: DFT Analysis (5B) · 2013-02-12  · Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover

5B DFT Analysis 8 Young Won Lim2/12/13

=8-pt DFT

2T = 8

Δ t5 = τ

f s5 =1τ

Δ f 5 =f s5

8= 1

8 τ

f h5 =f s5

2= 1

2 τ

Frequency and Time Interval (4)

The finer frequency resolution

Use zero padding

Page 9: DFT Analysis (5B) · 2013-02-12  · Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover

5B DFT Analysis 9 Young Won Lim2/12/13

=

Δ t

T

Δ f = 1T

Frequency and Time Interval (5)

Freq Domain Time Domain

f s =1Δ t

f h =f s

2= 1

2Δ t

Page 10: DFT Analysis (5B) · 2013-02-12  · Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover

5B DFT Analysis 10 Young Won Lim2/12/13

Page 11: DFT Analysis (5B) · 2013-02-12  · Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover

5B DFT Analysis 11 Young Won Lim2/12/13

Single-Sided Spectrum

x(t) = a0 + ∑k=1

(ak cos(k ω0 t) + bk sin(k ω0 t)) x(t) = g0 + ∑k=1

g k cos(k ω0 t + ϕk )

= cos(α) cos(β)

gk cos(k ω0 t + ϕk ) = g k cos (ϕk ) cos(k ω0 t) − g k sin(ϕk) sin(k ω0 t)

cos(α+β) − sin (α) sin(β)

a k cos(kω0 t ) + bk sin(k ω0 t)

a k = g k cos(ϕk)

−bk = g k sin(ϕk )

a k2+ bk

2 = g k2

−bk

ak= tan (ϕk)

a0 =1T ∫0

Tx(t) dt

a k =2T ∫0

Tx (t) cos (k ω0 t) dt

bk =2T ∫0

Tx (t ) sin (k ω0 t) dt

g0 = a0

gk = √ak2 + bk

2

ϕk = tan−1 (−bk

ak )k = +1,+2, ... k = +1,+2, ...

Page 12: DFT Analysis (5B) · 2013-02-12  · Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover

5B DFT Analysis 12 Young Won Lim2/12/13

Two-Sided Spectrum

x(t) = ∑k=−∞

+∞

C k e+ j kω0 tx( t) = ∑k=−∞

+∞

Ck e+ j kω0 t

Ck =1T ∫0

Tx (t ) e− j kω0 t dt

Ck =a0 (k = 0)12 (a k − jbk ) (k > 0)12 (a k + jbk ) (k < 0)

k = ... ,−2,−1, 0,+1,+2, ...

∣C k∣ =a0 (k = 0)12 √ak

2 + bk2 (k ≠ 0)

Arg (C k) =tan−1(−bk /ak ) (k > 0)tan−1(+bk /ak ) (k < 0)

Ck =1T ∫0

Tx (t ) e− j kω0 t dt

k = ... ,−2,−1, 0,+1,+2, ...

Ck =a0 (k = 0)12 g k e+ j ϕk (k > 0)12 g k e− j ϕk (k < 0)

∣C k∣ =a0 (k = 0)12∣g k∣ (k ≠ 0)

Arg (C k) =+ϕk (k > 0)−ϕk (k < 0)

Power Spectrum Periodogram∣C k∣

2+∣C−k∣2 = 1

2 g k2 = 1

2 (ak2 + bk

2) 2⋅∣C k∣ = gk = √ak2 + bk

2

Two-Sided One-Sided

Page 13: DFT Analysis (5B) · 2013-02-12  · Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover

5B DFT Analysis 13 Young Won Lim2/12/13

Power Spectrum using FFT

X [k ] = ∑n = 0

N − 1

x [n] e− j(2π/N )k n

x [n] = 1N ∑k = 0

N −1

X [k ] e+ j (2π/N )k n

Discrete Fourier Transform

X = fft(x)

x = ifft(X)

x( t) = ∑k=−∞

+∞

Ck e+ j kω0 t CTFS

xFS (t) = ∑k=−M

+M

γ k e+ j kω 0 tDTFS fc = fft(x)/N = X/N

Approximated Fourier Series Coefficients

x = ifft(fc)*NC k ≈ γk =X [ k ]

NApproximatedFourier Coefficients

∣C k∣2 ≈ ∣X [k ]∣2

N 2

Approximated Power Spectrum

Page 14: DFT Analysis (5B) · 2013-02-12  · Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover

5B DFT Analysis 14 Young Won Lim2/12/13

Periodogram using FFT

C k ≈ γk =X [ k ]

NApproximatedFourier Coefficients

∣C k∣2 ≈ ∣X [k ]∣2

N 2

Approximated Power Spectrum

1N ∑n=0

N−1

x2 [n] = 1N 2∑

k=0

N−1

∣X [k ]∣2AveragePower

( √∑k=0

N−1 ∣X [k ]∣2

NN )

2

∣X [k ]∣2

Nk=0,1, ... , N−1

RMS of sq rootPeriodogram

Approximated Periodogram

Approximated Power Spectrum

∣X [k ]∣√N

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

Δ N Δ

1T∫0

T

g 2(t) dt

1N Δ ∑k=0

N−1

∣g [k ]∣2Δ = 1N ∑k=0

N−1

∣g [k ]∣2

RMS in discrete time

RMS in continuous time

Square root Periodogram

Page 15: DFT Analysis (5B) · 2013-02-12  · Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover

5B DFT Analysis 15 Young Won Lim2/12/13

From CTFS to CTFT

X ( jω) = ∫−∞+∞

x (t) e− jω t d t x(t) = 12π ∫−∞

+∞X ( jω) e+ jω t d ω

C k =1T ∫0

Tx (t ) e− j k ω0 t dt x(t) = ∑

n=0

C k e+ j k ω0 t

Continuous Time Fourier Series

Continuous Time Fourier Transform

C k =1

T 0∫−T 0 /2

+T 0 /2xT 0(t ) e− j kω0 t dt

C k T 0 = ∫−T 0/2

+T 0/2 xT 0(t) e− j k ω0 t dt

xT 0(t) = ∑

n=0

C k e+ j kω0 t ⋅ 2π2π

⋅T 0

T 0

xT 0(t) = 1

2π ∑k=0

C k T 0 e+ j k ω0 t⋅ 2πT 0

T 0→∞ ω0 =2πT 0→d ω C k T 0→ X ( jω) xT 0

→ x (t)

Page 16: DFT Analysis (5B) · 2013-02-12  · Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover

5B DFT Analysis 16 Young Won Lim2/12/13

CTFS and CTFT

X [k ] = ∑n= 0

N − 1

x [n] e− j (2π/N )k n

x [n] = 1N ∑k = 0

N − 1

X [k ] e+ j (2π/N ) k n

Discrete Fourier Transform

C k T 0 = ∫−T 0 /2

+T 0 /2xT 0(t) e− j kω0 t dt

xT 0(t) = 1

2π ∑k=0

C k T 0 e+ j kω0 t⋅ 2πT 0

x [n] = ∑k=−M

+M

γk e+ j(2πN )nk

n = 0, 1, 2, ... , N−1,

γk =1N ∑n=0

N−1

x [n] e− j(2π

N )nk

k = −M , ... , 0, ... , +M

C k ≈ γk =X [ k ]

NApproximated Fourier Coefficients

Discrete Fourier Transform

X ( jω) = ∫−∞+∞

x(t) e− jω t d t

x( t) = 12π ∫−∞

+∞X ( jω) e+ jω t d ω

Continuous Time Fourier Series Continuous Time Fourier Transform

T 0 → ∞ , ω0 → 0 (ω0 → d ω)

Page 17: DFT Analysis (5B) · 2013-02-12  · Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover

5B DFT Analysis 17 Young Won Lim2/12/13

1N X (k )

1N X (k ) k=0, N

2

2N X (k ) k=1,⋯ , N

2−1

k Δ f

Periodic Signals

Δ f = 1N Δ t

Δ tN X (k)

k=0, N2

2Δ tN X (k ) k=1,⋯ , N

2−1

Δ tN X (k)

k Δ f

Aperiodic Signals

Δ f = 1N Δ t

One Sided F.S. Coefficient

Frequency Bin

Frequency Spacing

Two Sided F.S. Coefficient

FS Coefficients of Periodic and Aperiodic Signals

Page 18: DFT Analysis (5B) · 2013-02-12  · Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover

5B DFT Analysis 18 Young Won Lim2/12/13

One-Sided Amplitude Spectrum

Frequency Bin

Two-Sided Amplitude Spectrum

Ak =1N ∣X [k ]∣

k = 0,1,2,⋯ , N−1

Ak =1N ∣X [0]∣ k=0

Ak =2N ∣X [k ]∣ k=1,2,⋯, N / 2

f = kN f s

Phase Spectrum

ϕk = tan−1( ℑ{X [k ] }ℜ{X [ k ] }) k=0,1,2,⋯, N−1

Two-Sided Power Spectrum

Pk =1

N 2∣X [k ]∣2

k = 0,1,2,⋯ , N−1

Pk =1

N 2∣X [0]∣2 k=0

Pk =2

N 2∣X [k ]∣2 k=1,2,⋯ , N / 2

One-Sided Power Spectrum

Frequency Bin

f = kN f s

= 1N √ℜ2 {X [k ] }+ℑ2 {X [k ] } = 1

N 2 (ℜ2{X [k ] }+ℑ2 {X [k ] } )

Spectrum of Periodic Signals

Page 19: DFT Analysis (5B) · 2013-02-12  · Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover

5B DFT Analysis 19 Young Won Lim2/12/13

Power Spectrum and Power Spectral Density

Δ f = 1N f s=

1N T

Power Spectrum

X [k ] = 1N ∣X [ k ]∣

2

Δ f = 1N f s=

1N T

Power Spectral Density

X [k ] = TN ∣X [ k ]∣

2

Δ ff s= 1

N

Power Spectral Density

X [k ] = 1N ∣X [ k ]∣

2

Hz

Hz ▪ sec

Normalized Frequency

1N ∑n=0

N−1

x2 [n] = 1N 2∑

k=0

N−1

∣X [k ]∣2

⇒ ∑k=0

N−1

S [k ]Δ f

= 1NT ∑k=0

N−1

S [k ] = 1N 2∑

k=0

N−1

∣X [k ]∣2

S [k ] = TN ∣X [ k ]∣2

Periodogram → Power Spectral Density

Page 20: DFT Analysis (5B) · 2013-02-12  · Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover

5B DFT Analysis 20 Young Won Lim2/12/13

k=0, N2

k=1,⋯ , N2−1

k Δ f

Random Signals

Δ f = 1N Δ t

One Sided Power Spectral Density

Frequency Bin

Frequency Spacing

Two Sided Power Spectral Density

FS Coefficients of Random Signals

P=∑k=0

N−1

S (k )Δ f

P=∑k=0

N /2

S1(k)Δ f

S1(k )=2S(k)S1(k )=S (k )

∑ S Δ f= 1N Δ t∑ S

S (k)= Δ tN ∣X (k )∣

2

1N Δ t∑ x2Δ t

Page 21: DFT Analysis (5B) · 2013-02-12  · Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover

5B DFT Analysis 21 Young Won Lim2/12/13

Signals without discontinuitySignals with discontinuity

Sampling frequency is not an integer multiple of the FFT length

Leakage

Page 22: DFT Analysis (5B) · 2013-02-12  · Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover

5B DFT Analysis 22 Young Won Lim2/12/13

[0, f s

2 ]

Page 23: DFT Analysis (5B) · 2013-02-12  · Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover

5B DFT Analysis 23 Young Won Lim2/12/13

f (t )

f (t ) e− jω t

A continuous sum of weighted exponential functions :

−∞ < ω < +∞ℜ

ℑFourier Transform

Not so useful in transient analysis

Laplace Transform

f (t ) e−st = f (t )e−(σ + jω)t

ℜ(s)=σ

ℑ( s)=ω

Linear Time Domain Analysis

Initial Condition

Page 24: DFT Analysis (5B) · 2013-02-12  · Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover

5B DFT Analysis 24 Young Won Lim2/12/13

z Transform

f [n] z−n

Discrete Time System

Difference Equation

z = esT = eσT e jωT

ℜ(s)=σ

ℑ( s)=ω

Page 25: DFT Analysis (5B) · 2013-02-12  · Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover

5B DFT Analysis 25 Young Won Lim2/12/13

Page 26: DFT Analysis (5B) · 2013-02-12  · Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover

Young Won Lim2/12/13

References

[1] http://en.wikipedia.org/[2] J.H. McClellan, et al., Signal Processing First, Pearson Prentice Hall, 2003[3] A “graphical interpretation” of the DFT and FFT, by Steve Mann