5.3 Fourier Transformation
Definition
\[ H(f) = \int_{-\infty}^{+\infty} h(t) e^{-2 \pi i f t} dt \]
\[ h(t) = \int_{-\infty}^{+\infty} H(f) e^{2 \pi i f t} df \]
or
\[ F(\omega) = \int_{-\infty}^{+\infty} f(t) e^{-i \omega t} dt \]
\[ f(t) = \frac{1}{2 \pi} \int_{-\infty}^{+\infty} F(\omega) e^{i \omega t} d\omega \]
f: frequencey
\(\omega\) : angular speed (radian/second) = \(2 \pi f\)
\(e^{ix}\) = con x + i sin x
h(t) : function in time domain
H(f): function in frequency domain
(Definition can vary by books.)
Meaning of the Fourier Transformation
Any function can be presented with the combination of sine or cosine functions.
Especially periodic functions can be presented simply after Fourier transformation.
Definition of Discrete Fourier Transformation
\[ Y_{k+1} = \sum _{j=0}^{N-1} y_{j+1} e^{-2 \pi i j k / N} \]
Reference: Garcia AL. Numerical Methods for Physics. 5.2 Spectral Analysis. p132-140
sft
## function (y)
## {
## N = length(y)
## yt = matrix(nrow = N, ncol = 3)
## twopiN = -2 * pi/N
## for (k in 0:(N - 1)) {
## yt[k + 1, 1] = sum(y * cos(twopiN * (0:(N - 1)) * k))
## yt[k + 1, 2] = sum(y * sin(twopiN * (0:(N - 1)) * k))
## yt[k + 1, 3] = yt[k + 1, 1]^2 + yt[k + 1, 2]^2
## }
## return(yt)
## }
## <bytecode: 0x000001e2ac05abe8>
## <environment: namespace:math>
Reproducing Figures from 5.7 to 5.10
# Figure 5.7
= 50 # Number of points
N = 0.2 # Frequency of sine wave
freq = 0 # Phase of sine wave
phase = 1 # Time increment
tau = 0:(N-1) * tau
t = sin(2*pi*t*freq + phase)
y
= sft(y)
yt plot(t/N, yt[,1], type="l", lty=1, ylim=c(-30,30), xlab="Frequency",
ylab="Fourier Transform", main="Fig 5.7")
lines(t/N, yt[,2], lty=2)
mtext("Real(solid); Imag(dash)", side=3)
# Figure 5.8
= 50 # Number of points
N = 0.2 # Frequency of sine wave
freq = pi / 2 # Phase of sine wave
phase = 1 # Time increment
tau = 0:(N-1) * tau
t = sin(2*pi*t*freq + phase)
y2
= sft(y2)
yt2 plot(t/N, yt2[,1], type="l", lty=1, xlab="Frequency",
ylab="Fourier Transform", main="Fig 5.8")
lines(t/N, yt2[,2], lty=2)
mtext("Real(solid); Imag(dash)", side=3)
# Figure 5.9
= 50 # Number of points
N = 0.2123 # Frequency of sine wave
freq = 0 # Phase of sine wave
phase = 1 # Time increment
tau = 0:(N-1) * tau
t = sin(2*pi*t*freq + phase)
y3
= sft(y3)
yt3 plot(t/N, yt3[,1], type="l", lty=1, ylim=c(-20,20), xlab="Frequency",
ylab="Fourier Transform", main="Fig 5.9")
lines(t/N, yt3[,2], lty=2)
mtext("Real(solid); Imag(dash)", side=3)
# Figure 5.10
plot(t/N, yt3[,3], type="l", lty=1, ylim=c(0.1, 1000), xlab="Frequency",
ylab="Power", log="y", main="Fig 5.10")
mtext("Real(solid); Imag(dash)", side=3)