Title: Basic properties of Fourier Transforms
1- Lecture 16
- Basic properties of Fourier Transforms
2MatLab Code
- setup
- N256
- dt1.0
- tmaxdt(N-1)
- tdt0N-1
- fmax1/(2.0dt)
- dffmax/(N/2)
- fdf0N/2,-N/21-1'
- dw2pidf
- wdw0N/2,-N/21-1'
- a sample function, p(t)
- w0 2pifmax/10
- p sin(w0t).exp(-0.25w0t)
- ptfft(p) fourier transform
- prifft(pt) inverse transform
3p(t)
t
ifft(fft(p))
t
41 Relationship to integral transforms
- Integral transforms
- C(w) ?-?? T(t) exp(-iwt) dt
- T(t) (1/2p) ?-?? C(w) exp(iwt) dw
- Discrete transforms
- Ck Sn-N/2N/2 Tn exp(-2pikn/N ) with k-½N, ,
½N - Tn N-1Sk-N/2N/2 Ck exp(2pikn/N ) with n-½N,
, ½N - (this agrees with definition in MatLab HELP)
5- wk kDw and tn nDt and Dw 2p/(NDt)
- so DwDt 2p/N
- Ck C(wk) ?-?? T(t) exp(-iwkt) dt
- ? Dt Sn-N/2N/2 T(tn) exp(-iwktn)
- Dt Sn-N/2N/2 Tn exp(-i kDw nDt)
- Dt Sn-N/2N/2 Tn exp(-2pi kn / N )
So forward integral transform is Dt times
discrete forward transform
6- wk kDw and tn nDt and Dw 2p/(NDt)
- so DwDt2p/N and Dw/2p 1/(NDt)
- T(tn) (1/2p) ?-?? C(w) exp(iwtn) dw
- ? (Dw/2p) Sk-N/2N/2 C(wk) exp(iwktn)
- (1/Dt) N-1 Sk-N/2N/2 Ck exp(i kDw nDt)
- (1/Dt) N-1 Sk-N/2N/2 Ck exp(2pi kn / N )
So inverse integral transform is 1/Dt times
inverse discrete transform
7So
- Except for a normalization factor of Dt,
- The discrete transform is just the Riemann Sum
approximation to the integral transform, with
particular choice DwDt2p/N - Properties of the integral transform carry over
to the discrete transform (well, more-or-less)
8Error Estimates for the DFT
- Assume uncorrelated, normally-distributed data,
dnTn, with variance sd2 - The matrix G in Gmd is GnkN-1 exp(2pikn/N )
- The problem Gmd is linear, so the unknowns,
mkCk, (the coefficients of the complex
exponentials) are also normally-distributed. - Since exponentials are orthogonal, GHGN-1I is
diagonal - and Cm sd2 GHG-1 N-1sd2I is diagonal, too
- Apportioning variance equally between real and
imaginary parts of Cm, each has variance s2
N-1sd2/2. - The spectrum sm2 Crm2 Cim2 is the sum of two
uncorrelated, normally distributed random
variables and is thus c22-distributed. - The 95 value of c22 is about 5.9, so that to be
significant, a peak must exceed 5.9N-1sd2/2
9example
- f(t) exp(-a2t2)
- f(w) ?-?? exp(-a2t2) exp(-iwt) dt
- 2 ?0? exp(-a2t2) cos(wt) dt
- ?p exp( -w2/4a2 ) / a
- See integral 679 of CRC Math Tables
- Note, by the way, that the Fourier transform of a
Gaussian is a Gaussian Furthermore, the wider in
t, the narrower in w.
10Dt fft( exp(-a2t2) ) with a0.05
w
?p exp( -w2/4a2 ) / a with a0.05
w
112 area under T(t)
- C(w0) is the area under T(t)
area
T(t)
0
12- C(w) ?-?? T(t) exp(-iwt) dt
- C(w0)
- ?-?? T(t) exp(0) dt
- ?-?? T(t) dt area
13area dt ? sum(p) 18.2245
t
area Dt ? real(fft(p)) 18.2245
t
143 Time shift
- Multiplying C(w) by
- exp(-iwt0)
- shifts the timeseries T(t) by t0.
T(t)
T(t-t0)
t
t0
0
0
15- C(w) ?-?? T(t) exp(-iwt) dt
- Transform(shifted)
- ?-?? T(t-t0) exp(-iwt) dt
- ?-?? T(t) exp-iw(tt0) dt
- exp(-iwt0) ?-?? T(t) exp(-iwt) dt
- exp(-iwt0) Transform(unshifted)
t t-t0 so ttt0 and dtdt and t?? as t??
16p(t)
t
ifft(exp(-iwt0)?fft(p(t))) with t050
t
174 derivative
- Multiplying C(w) by
- iw
- Gives the transform of dT/dt
18- transform(dT/dt)
- ?-?? dT/dt exp(-iwt) dt
- T exp(iwt) -??
- iw ?-?? T exp(iwt) dt
- -iw transform(T)
-
Integration by parts ? u dv uv - ? v du u
exp(iwt) dv(dT/dt) dt du -iw exp(-iwt) dt v
?dv T
assuming T exp(iwt) -?? 0
19p(t)
dp/dt
ifft( iw fft(p))
205 integral
- Dividing C(w) by
- iw
- Gives the transform of ? T dt
- but note that you must set the zero-frequency
element manually, since 1/w is undefined at w0.
Furthermore, this process is not very stable,
since 1/w can be very large for small ws.
21p(t)
t
Dt?cumsum(p)
t
a bit of drift, presumably due to round off error
ifft(fft(p)/(iw))
t
226 convolution
- The transform of
- the convolution of two timeseries
- is the product of their
- transforms
23- transform( f(t)g(t) )
- ?-?? ?-?? f(t-t) g(t) dt exp(iwt) dt
- ?-?? g(t) ?-?? f(t-t) exp(iwt) dt dt
- ?-?? g(t) ?-?? f(t) expiw(tt) dt dt
- ?-?? g(t) exp(iwt) dt ?-?? f(t) exp(iwt) dt
- transform(g(t)) transform(f(t))
tt-t so ttt dt dt
24f(t)
g(t)
t
conv(g,f)
t
ifft(fft(g)?fft(f))
t
257 FFT of a spike at t0 is a constant
- C(w) ?-?? d(t) exp(-iwt) dt exp(0) 1
26p(t) is a spike at t00
t
real(fft(p))
imag(fft(p))
w
277 FFT of a spike at tt0 is sinusoidal
- C(w) ?-?? d(t-t0) exp(-iwt) dt exp(-iwt0)
- cos(wt0) - i sin(wt0)
28p(t) is a spike at t05
t
5
real(fft(p))cos(wt0)
imag(fft(p))sin(wt0)
w
298 FFT of a sinusoid cos(w1t) is a pair of spikes
at ww1
- Note rule ?-?? exp(-iw1t) exp(iw2t) dt
d(w1-w2) - cos(w1t) ½ exp(iw1t) exp(-iw1t)
- ?-?? cos(w1t) exp(-iwt) dt
- ½ ?-?? exp(iw1t) exp(-iwt) dt ½ ?-??
exp(iw1t) exp(-iwt) dt - ½ d(w-w1) d(ww1)
30p(t)cos(w1t)
t
real(fft(p))
imag(fft(p))0
w
w1
31Aliasingthe tendency in a digital world for
high frequencies to look like low frequencies
32MatLab Script to evaluate cosines at ever
increasing frequency
- L 0 make plots in groups of 10 starting at
frequency L1 - for k 110
- w1 (Lk)dw
- pcos(w1t)
- subplot(10,1,k)
- plot(t,p,'b')
- hold on
- axis( 0, tmax, -1.5, 1.5 )
- end
33cos(kDwt)
k1
k10
t
34same!
cos(kDwt)
k11
k16
nyquist
k21
t
35cos(kDwt)
k21
k31
frequencies seem to be getting lower!
t
36cos(kDwt)
k31
k41
but now higher again!
t
37in a digital world we have chosen DwDt 2p/N
- sin(wntk) sin(kDwnDt) sin(knDwDt)
sin(2pkn/N) - cos(wntk) cos(kDwnDt) cos(knDwDt)
cos(2pkn/N) - let mnN
- sin(wmtk) sink(nN)DwDt sin2pk(nN)/N
- cos(2pkn/N) sin(2pk) sin(2pkn/N) cos(2pk)
- cos(wmtk) cosk(nN)DwDt cos2pk(nN)/N
- cos(2pkn/N) cos(2pk) - sin(2pkn/N) sin(2pk)
- but sin(2pk)0 and cos(2pk)1 for all integers k,
so - sin(wmtk)sin(wntk) and cos(wmtk)cos(wntk)
38in a digital world wnN wn andsince time
and frequency play symmetrical roles in
exp(-iwt) tkN tk
39Example cos(w0t) with w0wny/20 sampled with
frequency w0wny/32
40Now connect the dots the resulting function has a
lower frequency
41wnN wn let n-m, then w-m wN-m
42This is why the fourier coefficientsof negative
frequenciesare placed at the high frequency
end of the transform vectorthey are the high
frequency coefficients
43lets reconsider the example where we computed the
Fourier Transform ofp(t) exp(-a2t2)this
function is non-zero at negative times
p(t)
0
t
44you must not just leave out the values of the
function at negative timesyoud be leaving out
half the informationinstead, you must wrap them
to large times using the rule t-m tN-m
45so you must put the negative values at the right
and end of the vector, p
- N256
- dt0.5
- tmaxdt(N/2)
- tmindt(-N/21)
- tdt0N/2,-N/21-1' note put negative
times on the end ... - fmax1/(2.0dt)
- dffmax/(N/2)
- fdf0N/2,-N/21-1'
- dw2pidf
- wdw0N/2,-N/21-1'
- a0.05
- p exp( -(at).2 )
- ptfft(p)
p(t)
0
t
p(t)
0
t
t
46Remember the Time shift ?
- Multiplying C(w) by exp(-iwt0) shifts the
timeseries T(t) by t0. - What if we try to shift it by more than the
length of the time-series? - It just wraps around
47with N256, trying to shift it 280Dt just shifts
it 280-25624
24