TExcelTAD
Home › Fourier Analysis & Signals › From Series to Transform

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 TT grows without bound: the harmonics k/Tk/T crowd together into a continuum of frequencies, and the sum becomes an integral.

Letting the period grow

Take a pulse f(t)f(t) that is zero outside [−1/2,1/2][-1/2, 1/2] and repeat it with period TT. Its Fourier coefficients are

ck=1T∫−T/2T/2f(t) e−2πi(k/T)t dt=1T f^ ⁣(kT),f^(s)=∫−∞∞f(t) e−2πist dtc_k = \frac{1}{T} \int_{-T/2}^{T/2} f(t)\, e^{-2\pi i (k/T) t}\, dt = \frac{1}{T}\, \hat{f}\!\left(\frac{k}{T}\right), \qquad \hat{f}(s) = \int_{-\infty}^{\infty} f(t)\, e^{-2\pi i s t}\, dt

The spacing between harmonics is 1/T1/T. As T→∞T \to \infty the coefficients shrink like 1/T1/T, but TckT c_k stays on one fixed curve f^(s)\hat{f}(s): the Fourier transform.

python · try it yourself
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, TckT c_k lies on the curve sinc⁡(s)=sin⁡(πs)/(πs)\operatorname{sinc}(s) = \sin(\pi s)/(\pi s), 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:

f^(s)=∫−∞∞f(t) e−2πist dt,f(t)=∫−∞∞f^(s) e2πist ds\hat{f}(s) = \int_{-\infty}^{\infty} f(t)\, e^{-2\pi i s t}\, dt, \qquad f(t) = \int_{-\infty}^{\infty} \hat{f}(s)\, e^{2\pi i s t}\, ds

Here ss is frequency in cycles per unit time (Hz when tt is in seconds). This is Osgood's convention: the 2π2\pi sits in the exponent, so no constant appears in front of either integral. Other books use angular frequency ω=2πs\omega = 2\pi s and put 1/(2π)1/(2\pi) 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:

python · try it yourself
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 e−πt2e^{-\pi t^2} 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 e−2πiste^{-2\pi i s t} 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 f0=1/T=10f_0 = 1/T = 10 Hz. Repeating less often (larger TT) packs them closer.

Exercise 2: Conventions

With angular frequency ω=2πs\omega = 2\pi s, write the forward transform.

Answer

F(ω)=∫f(t)e−iωt dtF(\omega) = \int f(t) e^{-i\omega t}\,dt, so F(ω)=f^(ω/(2π))F(\omega) = \hat{f}(\omega/(2\pi)).

Solution

Substitute s=ω/(2π)s = \omega/(2\pi) in the exponent. The inverse then needs 12π∫F(ω)eiωt dω\frac{1}{2\pi}\int F(\omega) e^{i\omega t}\,d\omega, because ds=dω/(2π)ds = d\omega/(2\pi).

Exercise 3: Transform of a two-sided exponential (code)

Numerically compute the transform of e−∣t∣e^{-\lvert t \rvert} at s=0,0.25,0.5s = 0, 0.25, 0.5 and compare with 2/(1+4π2s2)2/(1 + 4\pi^2 s^2).

Answer

2.0, about 0.5768 and 0.1840 both ways.

Solution
python · try it yourself
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 e−∣t∣e^{-\lvert t \rvert} at t=0t = 0 makes its transform decay only like 1/s21/s^2, much slower than the Gaussian's.

Test yourself

As the period TT of a repeated pulse grows, the harmonic spacing…

  1. grows
  2. shrinks like 1/T1/T
  3. stays the same
  4. becomes T2T^2

In Osgood's convention, the forward Fourier transform is…

  1. ∫f(t)e−2πist dt\int f(t) e^{-2\pi i s t}\,dt
  2. 12π∫f(t)e−ist dt\frac{1}{2\pi}\int f(t) e^{-i s t}\,dt
  3. ∑f(t)e−st\sum f(t) e^{-st}
  4. ∫f(t)est dt\int f(t) e^{st}\,dt

The Fourier transform of the rectangle pulse of width 1 is…

  1. a Gaussian
  2. sinc⁡(s)=sin⁡(πs)/(πs)\operatorname{sinc}(s) = \sin(\pi s)/(\pi s)
  3. a rectangle
  4. a delta