From Series to Transform
Fourier series handle periodic signals. Most signals (a single click, a spoken word, a pulse) are not periodic. Osgood's route to the Fourier transform is to treat a single pulse as one period of a periodic signal whose period grows without bound: the harmonics crowd together into a continuum of frequencies, and the sum becomes an integral.
Letting the period grow
Take a pulse that is zero outside and repeat it with period . Its Fourier coefficients are
The spacing between harmonics is . As the coefficients shrink like , but stays on one fixed curve : the Fourier transform.
import numpy as np
def rect(t):
return (np.abs(t) < 0.5).astype(float)
for T in (2, 4, 16):
N = 4096 * T // 2
t = (np.arange(N) / N - 0.5) * T # one period, centered
f = rect(t)
ks = np.arange(0, 4 * T // 2 + 1, T // 2) # harmonics at frequencies s = 0, 0.5, 1, 1.5, 2
Tc = [T * np.mean(f * np.exp(-2j * np.pi * k / T * t)).real for k in ks]
print(f"T={T:2d}: harmonic spacing {1 / T:.4f} T*c_k at s = 0, 0.5, 1, 1.5, 2:", (np.round(Tc, 3) + 0.0).tolist())
s = np.array([0, 0.5, 1, 1.5, 2])
print("sinc(s) = sin(pi s)/(pi s): ", (np.round(np.sinc(s), 3) + 0.0).tolist())T= 2: harmonic spacing 0.5000 T*c_k at s = 0, 0.5, 1, 1.5, 2: [1.0, 0.637, 0.0, -0.212, 0.0]
T= 4: harmonic spacing 0.2500 T*c_k at s = 0, 0.5, 1, 1.5, 2: [1.0, 0.637, 0.0, -0.212, 0.0]
T=16: harmonic spacing 0.0625 T*c_k at s = 0, 0.5, 1, 1.5, 2: [1.0, 0.637, 0.0, -0.212, 0.0]
sinc(s) = sin(pi s)/(pi s): [1.0, 0.637, 0.0, -0.212, 0.0]
Whatever the period, lies on the curve , which is the transform of the rectangle pulse. A longer period just samples that curve more densely.
The transform pair
The limit of the series is the Fourier transform and its inverse:
Here is frequency in cycles per unit time (Hz when is in seconds). This is Osgood's convention: the sits in the exponent, so no constant appears in front of either integral. Other books use angular frequency and put in front of the inverse; the results are the same up to that change of variables.
Numerically, a transform is a fine sum
On a computer we approximate the integral by a Riemann sum over a long, finely sampled window:
import numpy as np
dt = 0.001
t = np.arange(-20, 20, dt)
f = np.exp(-np.pi * t ** 2) # the Gaussian
def ft(s):
return np.sum(f * np.exp(-2j * np.pi * s * t)) * dt
for s in (0, 0.5, 1.0, 1.5):
val = ft(s)
print(f"s={s}: transform {val.real:.6f} (imaginary part negligible: {abs(val.imag) < 1e-12}) exp(-pi s^2) = {np.exp(-np.pi * s ** 2):.6f}")s=0: transform 1.000000 (imaginary part negligible: True) exp(-pi s^2) = 1.000000
s=0.5: transform 0.455938 (imaginary part negligible: True) exp(-pi s^2) = 0.455938
s=1.0: transform 0.043214 (imaginary part negligible: True) exp(-pi s^2) = 0.043214
s=1.5: transform 0.000851 (imaginary part negligible: True) exp(-pi s^2) = 0.000851
The Gaussian is its own Fourier transform, a fact we will use often (The Fourier Transform).
In software
- No computer evaluates the integral exactly: in practice the transform is approximated by the DFT of samples, which is the series idea run backwards (sampling in time makes the spectrum periodic).
- Symbolic transforms are available in SymPy (
sympy.fourier_transform, which uses the same convention).
Exercises
Exercise 1: Spacing
A pulse is repeated every 0.1 s. What is the spacing of the harmonics in its Fourier series?
Answer
10 Hz.
Solution
Harmonics sit at multiples of Hz. Repeating less often (larger ) packs them closer.
Exercise 2: Conventions
With angular frequency , write the forward transform.
Answer
, so .
Solution
Substitute in the exponent. The inverse then needs , because .
Exercise 3: Transform of a two-sided exponential (code)
Numerically compute the transform of at and compare with .
Answer
2.0, about 0.5768 and 0.1840 both ways.
Solution
import numpy as np
dt = 0.0005
t = np.arange(-40, 40, dt)
f = np.exp(-np.abs(t))
for s in (0, 0.25, 0.5):
val = np.sum(f * np.exp(-2j * np.pi * s * t)) * dt
print(s, round(val.real, 4), round(2 / (1 + 4 * np.pi ** 2 * s ** 2), 4))0 2.0 2.0
0.25 0.5768 0.5768
0.5 0.184 0.184
The corner of at makes its transform decay only like , much slower than the Gaussian's.
Test yourself
As the period of a repeated pulse grows, the harmonic spacing…
- grows
- shrinks like
- stays the same
- becomes
In Osgood's convention, the forward Fourier transform is…
The Fourier transform of the rectangle pulse of width 1 is…
- a Gaussian
- a rectangle
- a delta