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
N     = 50     # Number of points
freq  = 0.2    # Frequency of sine wave
phase = 0      # Phase of sine wave
tau   = 1      # Time increment
t = 0:(N-1) * tau
y = sin(2*pi*t*freq + phase)

yt = sft(y)
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
N     = 50     # Number of points
freq  = 0.2    # Frequency of sine wave
phase = pi / 2      # Phase of sine wave
tau   = 1      # Time increment
t = 0:(N-1) * tau
y2 = sin(2*pi*t*freq + phase)

yt2 = sft(y2)
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
N     = 50     # Number of points
freq  = 0.2123    # Frequency of sine wave
phase = 0      # Phase of sine wave
tau   = 1      # Time increment
t = 0:(N-1) * tau
y3 = sin(2*pi*t*freq + phase)

yt3 = sft(y3)
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)