fundamentals of the discrete fourier...
TRANSCRIPT
Fundamentals of the Discrete Fourier Transform
Michael G. Sideris [email protected]
Department of Geomatics Engineering
University of Calgary
Seminar presentation at the Politecnico di Milano, Como, November 12, 2012
Contents (1) n From Fourier Series to the Continuous Fourier Transform
¨ Sinusoids
¨ Fourier Series
¨ The Continuous Fourier Transform (CFT)
n Important elementary functions and their CFTs ¨ The impulse function
¨ The CFT of sine and cosine
¨ The sampling function
¨ The rectangle and sinc functions
n Properties of the CFT
n Convolution and Correlation ¨ Properties of convolution
Contents (2) n From the CFT to the DFT (Discrete Fourier Transform)
¨ Aliasing
¨ Leakage
¨ Periodicity
n The Discrete Fourier Transform ¨ Circular convolution
¨ Scale change
¨ Phase shifting
n Correlation, Covariance and Power Spectra Density functions
n The Fast Fourier Transform (FFT)
n The two-dimensional CFT and DFT
From Fourier Series to the Continuous Fourier Transform
Sinusoids
s(t)= A0 cos(ω0t +φ0 ) :Sinusoid of frequencyω0
A0 ..... amplitudeω0 ..... cyclic frequencyt ..... time (or distance)φ0 ..... phase angle
ω0 =2πT0
= 2π f0
T0 ..... periodf0 ..... (linear) frequency
s(t)= acosω0t +bsinω0twherea = A0 cosφ0, b = −A0 sinφ0
A0 = (a2 +b2 )1/2
φ0 = arctan(−ba
)
Expansion
€
Sinusoids in complex form
sc (t) = acosω0t ± iasinω0t = ae±iω 0t
Real sinusoids in complex form
s(t) =A0cos(ω0t + φ0) =
A0ei(ω0t+φ0 ) + e− i(ω0t+φ0 )
2=A0
2eiφ0eiω0t +
A0
2e− iφ0e− iω0t
Fourier Series
If g(t)= g(t +T ) ; g(t)dt0
T
∫ = g(t)dtt0
t0+T
∫ , then
g(t)= (an cos 2πnT
t +bn sin 2πnT
tn=0
∞
∑ )
an =2T
g(t)cosnt dt ; t0
t0+T
∫ bn =2T
g(t)sinnt dtt0
t0+T
∫
Provided that: g(t) has a finite numbers of maxima and minima in a period and a finite number of finite discontinuities (Dirichlet’s conditions)
Complex form :
g(t)= 1T
Gnn=−∞
∞
∑ eiωnt , ωn =2πnT
Gn = g(t)e−iωnt dt, Gn =12
(an − ibn ), n = 0,±1,−T /2
T /2
∫ ±2,....
Call Δω =2πT
⇒ ωn = nΔω1T=Δω2π
)
*+
,+ ⇒ g(t)= Gn
2πeiωntΔω
n=−∞
∞
∑
g(t)= 12π
G(ω)eiωt dω−∞
∞
∫ ⇒ Inverse CFT
G(ω)= g(t)−∞
∞
∫ e−iωtdt ⇒ Direct CFT
€
Sinceω = 2πfg(t)= G( f )ei2π ft df =
−∞
∞
∫ F-1 G( f ){ }
G( f )= g(t)−∞
∞
∫ e−i2π ftdt = F g(t){ }
G( f )=GR( f )+ iGI ( f )= G( f ) eiθ ( f )
Amplitude: G( f ) = GR2 ( f )+GI
2 ( f )"# $%1/2
Phase angle: θ( f )= Arg G( f ){ } = arctanGI ( f )GR( f )
€
G( f ) is complex
The Continuous Fourier Transform (1)
The Continuous Fourier Transform (2)
€
Conditions for Existence :
− The integral of g(t) from −∞ to +∞ exists (it is <∞)− g(t) has only finite discontinuities− If g(t) is periodic or impulse,G( f ) does not exist
Important elementary functions and their CFTs
The Impulse Function (1)
€
Definition :δ(t − t0) = 0, t ≠ t0
δ(t − t0)dt =1−∞
∞
∫
'
( )
* )
⇔ δ(t) = lima→0
f (t,a) ∫ =−∞
∞−
)t(dt)t()tt(
ondistributiaasDefinition
00 φφδ
The Impulse Function (2)
Definition as a generlized limit:
If n→∞lim fn (t)φ(t)dt = φ(0) ⇒ δ(t) =
−∞
∞
∫n→∞lim fn (t)
Properties:
δ(t0 )h(t) = h(t0 )δ(t0 )
δ(at) = a −1δ(t)
F Kδ(t){ } = K
e.g. If we define it as δ(t) = lima→∞
sinatπt
,
then cos(2π ft) df = ei2π ft df = δ(t)−∞
∞
∫−∞
∞
∫
Used, as a distribution, for the (otherwise nonexistent) CFT of periodic functions
The CTF of cosine and sine
€
Acos(2πfot) ↔ A2δ( f − fo) +
A2δ( f + fo)
Asin(2πfot) ↔ i A2δ( f + fo) − i
A2δ( f − fo)
The Sampling Function
III(t)= δ(t −nT )n=−∞
∞
∑ ↔ F III(t){ } =1T
δ( f − nT
)n=−∞
∞
∑
III(t) f (t)= f (nT )δ(t −nT ) ⇒ Digitizationn=−∞
∞
∑
Note that denser sampling in one domain transforms to sparser sampling in the other
The Rectangle and sinc Functions
€
h(t) =
A, t = T0 /2A /2, t = ±T0 /20, t > T0 /2
"
# $
% $
↔ H( f ) = 2ATosinc(2To f ),
sinc( f ) =sin(πf )πf
Properties of the CFT
Properties of the CFT (1)
n Linearity
n Symmetry
n Time scaling
n Time shifting
n Differentiation
n Integration
ah(t) + bg(t)↔ aH( f ) + bG( f )
H(t )↔ h(− f )
h(at)↔1aH(
fa)
h(t − to )↔ H( f )e−i 2πf to
∂ nh(t)∂tn
↔ (i 2πf )n H( f )
h(x )dx−∞
t
∫ ↔1
i 2πfH( f ) +
12H(0)δ( f )
Properties of the CFT (2)
n DC-value
n Even function
n Odd function
n Real function
n Imaginary function
h(t)dt−∞
∞
∫ = H(0)
hE (t) ↔ HE( f ) = RE( f )
hO(t )↔ HO( f ) = iIO ( f )
h(t) = hR (t)↔ H( f ) = RE( f ) + iIO ( f )
h(t) = ihI (t)↔ H( f ) = RO( f ) + iIE ( f )
Convolution and Correlation
Convolution and Correlation (1)
€
x(t) = g(t ')h(t − t ')dt '= g(t)∗ h(t) = h(t)∗ g(t) =−∞
∞
∫ h(t')g(t − t')dt'−∞
∞
∫
€
y(t) = g(t ')h(t + t ')dt '= g(t)⊗ h(t) ≠ h(t)⊗ g(t)−∞
∞
∫
Convolution theorem
X( f )= F g(t)∗h(t){ } = F g(t){ }F h(t){ } =G( f )H ( f )
Correlation theorem
Y ( f )= F g(t)⊗ h(t){ } =G( f )H *( f )
Convolution is the operation of filtering one of the functions by the other
Pictorial Representation of Convolution and Correlation
Convolution and Correlation (3) Properties:
a) If either g(t) or h(t) is even, then g(t)∗h(t)= g(t)⊗ h(t)b) g(t)∗h(t)= h(t)∗ g(t) convolution is commutativec) [g(t)∗h(t)]∗q(t)= h(t)∗[g(t)∗q(t)] convolution is associatived) k(t)∗[ag(t)∗bq(t)]= a[k(t)∗ g(t)]+b[k(t)∗q(t)] convolution is lineare) δ(t +τ )∗h(t)= h(t +τ ), δ(t)∗h(t)= h(t) δ(t) is the identity operator in convolutionf) x '(t)= (g(t)∗h(t))' = g '(t)∗h(t)= g(t)∗h '(t) the derivative of the convolution g) F h(t)g(t){ } = F h(t){ }∗F g(t){ } = H ( f )∗G( f )
Convolution and Correlation (4)
h) If h(t) and g(t) are time limited functions, i.e., non− zero in the domain −T0 ≤ t ≤T0, thenx(t)= h(x)∗ g(t) is time limitedwith twice the support of h(t) or g(t),
i.e., non− zero in the domain −2T0 ≤ t ≤ 2T0
i) Parseval's thereom:
h2 (t)e−2πσ t dt = H ( f )H (σ − f )df−∞
∞
∫−∞
∞
∫
with σ = 0 and for h(t) real: h2 (t)dt = H ( f ) 2 df−∞
∞
∫−∞
∞
∫
From the CFT to the DFT (Discrete Fourier Transform)
From the Continuous to the Discrete Fourier Transform
aliasing
leakage
periodicity
The Discrete Fourier Transform
The Discrete Fourier Transform (1)
€
H(mΔf ) = h(kΔt)e−i2πkΔtmΔfΔtk= 0
N−1
∑ = h(kΔt)e− i2πkm /NΔtk= 0
N−1
∑
h(kΔt) = H(mΔf )ei2πkΔtmΔfΔfm= 0
N−1
∑ = H(mΔf )ei2πkm /NΔfm= 0
N−1
∑
To =1Δf
= NΔt, Fo =1Δt
= NΔf
fN =Fo2=
12Δt
Nyquist frequency
h(kΔt)↔H (mΔf ) or h(tk )↔H ( fm ) or h(k)↔H (m)
Illustration of Nyquist Frequency Highest frequencies existing in the original signal cannot be reproduced from the samples In this example, a sinusoid of lower frequency is recovered (the higher frequencies cannot be recovered; they are “aliased” due to the under-sampling)
The Discrete Fourier Transform (2)
Discrete Convolution (1)
For g(k) and h(k) defined in 0 ≤ k < N:
x(k)= g(k)∗h(k)= g(l)h(k − l)Δtl=−∞
∞
∑ = g(l)h(k − l)Δtl=0
k
∑ , 0 ≤ k ≤ 2N −1
Linear Convolution
xc(k)= g(k) h(k)= g(l)h(k − l)M Δt
l=0
M−1
∑ DFTN← →&& F{g(k)}F{h(k)}
M-point Circular Convolution
Circularly shifted within M positions
xc(k)= g(l)h(k − l)M Δtl=0
M−1
∑ = g(l)h(k − l)Δtl=0
k
∑ + g(l)h(N + k − l)Δtl=k+1
M−1
∑
Linear convolution plus Aliasing
Discrete Convolution (2) Linear Convolution via FFT using Circular Convolution
xc(k)= x(k) iff g(l)h(M + k − l)Δtl=k+1
M−1
∑ = 0
which happens when M ≥ 2N −1
Zero-padding Procedure To compute the linear convolution of two functions given in 0 ≤ k ≤ N-1: 1. Append at least N-1 zeros to each function so that they are now
2N-1 samples long (preferably, 2p ≥ 2N-1) each 2. Use FFT to compute their spectra
3. Use FFT to compute the Inverse DFT of the product of the two
spectra. This, i.e., the resulting values for 0 ≤ k ≤ 2N-1, is the correct linear convolution of the two functions
Circular Convolution as Linear Convolution Plus Aliasing
The DFT in Computers Subroutines usually assume Δt = 1 and also ignore T0 This requires rescaling as follows:
€
H( fm ) = ToHc (m) = NΔtHc (m)x(tk ) = g(tk )∗ h(tk ) = Toxc (tk ) = ToFc
−1{Gc (m)Hc (m)}
It also yields: Hc(0) =
€
h
Subroutines also assume the origin at the left of the record This requires changing the phase of the spectrum by
€
h( tk − To / 2)↔ (−1)mH ( fm )
End point of a period must be omitted (assumed due to periodicity)
e−i2πmΔfTo /2 = e−iπm = cos(mπ )= (−1)m
Correlation, Covariance and Power Spectral Density functions
CR, CV and PSD Functions
Rgh (tk )=E{g(tl )h(tk + tl )} = limN→∞
1N g(tl )h(tk + tl )
l=0
N−1
∑ = limTo→∞
1Tog(tk )⊗ h(tk )
Cgh (tk )=E{{g(tl )− g][h(tk + tl )−h ]} = limN→∞
1N [g(tl )− g][h(tk + tl )
l=0
N−1
∑ −h ]
= limTo→∞
1Tog(tk )⊗ h(tk )− gh = Rgh (tk )− gh
Pgh ( fm )= F{Rgh (tk )} = limTo→∞
1ToG( fm )H ∗( fm )
Pgh ( fm )=1νTo
Gλ ( fm )Hλ∗ ( fm )
λ=1
ν
∑
Rgh (tk )= F−1{Pgh ( fm )}
Cgh (tk )= F−1{Pgh ( fm )− ghδ( fm )}
Definitions:
Computation by FFT:
The Fast Fourier Transform
The FFT - Flow Graph of Operations for N=4 H = Wh
FFT achieves its speed by factorizing W and exploring its symmetries in a way that the required number of multiplications and additions is drastically reduced
Computational efficiency: FFT vs DFT
Bergland (1969)
1D case DFT: O(N2) FFT: O(NlogN)
The 2D Continuous and Discrete Fourier Transform
The Two-dimensional CFT
H (u,v)= h(x, y)e−i2π (ux+vy) dxdy−∞
∞
∫−∞
∞
∫
h(x, y)= H (u,v)ei2π (ux+vy) dudv−∞
∞
∫−∞
∞
∫
H (u,v)= h(x, y)e−i2π (ux+vy) dxdy−∞
∞
∫−∞
∞
∫ = h(x, y)e−i2πuxe−i2πvy dxdy−∞
∞
∫−∞
∞
∫
= ( h(x, y)e−i2πux dx)e−i2πvy dy−∞
∞
∫−∞
∞
∫ = Fx−∞
∞
∫ {h(x, y)}e−i2πvydy
= Fy{Fx{h(x, y)}}
The Fourier Transform is a separable transform Very important for practical applications
The Two-dimensional DFT
SPACE DOMAIN FREQUENCY DOMAIN
€
H(um,vn ) = h(xk,yl )1= 0
N−1
∑k= 0
M −1
∑ e−i2π (mk /M +nl /N )ΔxΔy
h(xk,yl ) = H(um,vn )1= 0
N−1
∑k= 0
M −1
∑ ei2π (mk /M +nl /N )ΔuΔv
€
Δu =1Ty
=1
MΔx, Δv =
1Ty
=1
NΔy
Δx =1Fu
=1
MΔu=
12uN
, Δy =1Fv
=1
NΔv=
12vN
Concluding Remarks
Concluding Remarks Fourier Transforms are important in geodetic applications for, e.g., n Spectral analysis of data
¨ Can decide on the spectral content, appropriate sampling interval, and/or best computational method
n Digital signal/image processing n Filtering of data
¨ Filter design ¨ Noise minimization
n Efficient evaluation of convolutions and of covariance functions Fourier Transforms are subject to errors due to n Aliasing (sampling) n Leakage (truncation of domain) n Periodicity (digitization) n Data noise which should be understood and minimized in practical applications