← Signal & Image Processing

Waves and the Fourier spectrum: amplitude, frequency and phase

What amplitude, period, frequency, wavelength and phase mean, and how Fourier series and the Fourier transform turn a signal into an amplitude spectrum and a phase spectrum.

First explored December 2017·7 min read

wavesfourierspectrumphaseseismicsignal-processing

Seismic data, sound and images are all made of waves. Before getting into seismic wavelets or image filters, I wanted clear words for describing a single wave (amplitude, frequency, phase) and a tool that breaks any signal into lots of simple waves. That tool is Fourier analysis. I first wrote this in Persian in 2017, while working on seismic data quality control, and this is a rewritten English version.

What a wave is

A wave is energy spread out in space that moves through it. There are three big families: mechanical waves, electromagnetic waves and matter waves. Seismic surveys use sound waves, which are mechanical. Mechanical waves follow Newton’s laws and need some material to travel through, like air, water or rock layers.

You can describe a wave as a function of time (what one sensor records) or as a function of space (a snapshot along a line). A seismic section is a 2D wave field: one axis is time and the other is distance along the surface.

The parts of a simple wave

A 4 Hz sine wave with its peak, trough, period and amplitude marked

For a sine wave recorded over time:

  • Amplitude AA is the biggest distance from zero. A positive maximum is a peak and a negative one is a trough. In seismic recording, amplitude is often a voltage.
  • Period TT is the time between two neighbouring peaks (or troughs), so the time for one full cycle. It’s measured in seconds.
  • Frequency ff is the number of full cycles per second, measured in hertz (Hz). It’s just one over the period: f=1/Tf = 1/T.
  • Phase tells you where in its cycle the wave is at some reference time, usually t=0t = 0. It’s an angle: one full cycle is 360°360°, or 2π2\pi radians.

If you look at the wave along a line in space instead:

  • Wavelength λ\lambda is the distance between two neighbouring peaks, in metres.
  • Wavenumber is the space version of frequency: the number of cycles per unit length, k=1/λk = 1/\lambda. Geophysicists often give it in cycles per kilometre. Physicists often use the angular wavenumber 2π/λ2\pi/\lambda instead, so check which one a text means.

A cosine wave with all these pieces is

y(t)=Acos⁡(2πft+θ).y(t) = A\cos(2\pi f t + \theta).

There are two terms inside the cosine. The first, 2πft2\pi f t, is the angle the wave has gone through by time tt. The second, θ\theta, is the phase constant: the angle the wave started at when t=0t = 0. It’s worth keeping these two terms apart in your head. Changing either one shifts the phase, but the two kinds of change behave differently, as Seismic wavelets: amplitude and phase spectra shows.

Phase as a time delay

Say a sine wave with period T=0.5T = 0.5 s hits its first peak 0.120.12 s later than a reference wave that peaks at t=0t = 0. We say it has a time lag of 0.120.12 s. One full cycle is 2π2\pi radians, so the phase lag is

0.120.5×2π=0.48π rad.\frac{0.12}{0.5} \times 2\pi = 0.48\pi \text{ rad}.

By convention, phase is minus the phase lag, so this wave has phase −0.48π-0.48\pi. This sign confused me at first, and a simple picture helped: put the start time of each oscillator on a number line with zero at the origin. Starting late (to the right in time) gives a negative phase. Starting early gives a positive phase. Starting exactly at zero gives phase zero.

A spring as a one-frequency system

Hang a weight on an ideal spring, pull it down by 0.80.8 units and let go at t=0t = 0. The position traces a cosine. With a period of 8080 ms, the frequency is 1/0.08=12.51/0.08 = 12.5 Hz. A stiffer spring released from 0.40.4 units might have a period of 4040 ms, so 2525 Hz.

Now take a third spring, identical to the first, and let it go at the moment the first spring passes through zero, 2020 ms later. Both have the same amplitude and frequency. The only difference is a 2020 ms delay, which is a quarter of the period, so the phase lag is π/2\pi/2 (90°90°) and the phase is −90°-90°.

Three spring motions with their amplitude and phase spectra

If you plot each oscillation’s amplitude against its frequency, you get its amplitude spectrum. If you plot its phase against frequency, you get its phase spectrum. The first and third springs have the same amplitude spectrum but different phase spectra. This is the main idea: the amplitude spectrum says how much of each frequency there is, and the phase spectrum says when each one sits in time.

Fourier series: periodic functions as sums of sines

A function f(x)f(x) is periodic with period pp if f(x+p)=f(x)f(x + p) = f(x) for every xx. If pp is a period, then so are 2p2p, 3p3p, and so on.

A function with period 2L2L can be written as a Fourier series:

f(x)=a0+∑n=1∞[ancos⁡nπxL+bnsin⁡nπxL],f(x) = a_0 + \sum_{n=1}^{\infty}\left[a_n \cos\frac{n\pi x}{L} + b_n \sin\frac{n\pi x}{L}\right],

with coefficients given by the Euler formulas

a0=12L∫−LLf(x) dx,an=1L∫−LLf(x)cos⁡nπxL dx,bn=1L∫−LLf(x)sin⁡nπxL dx.a_0 = \frac{1}{2L}\int_{-L}^{L} f(x)\,dx,\quad a_n = \frac{1}{L}\int_{-L}^{L} f(x)\cos\frac{n\pi x}{L}\,dx,\quad b_n = \frac{1}{L}\int_{-L}^{L} f(x)\sin\frac{n\pi x}{L}\,dx.

Why do these formulas work? Because the sines and cosines are orthogonal on any interval of length 2L2L: if you multiply any two different ones together and integrate, you get zero. So when you multiply ff by one basis function and integrate, everything else drops out and you’re left with exactly that function’s coefficient.

With Euler’s formula eiϕ=cos⁡ϕ+isin⁡ϕe^{i\phi} = \cos\phi + i\sin\phi, the same series has a shorter complex form:

f(x)=∑n=−∞∞cneinπx/L,cn=12L∫−LLf(x) e−inπx/L dx.f(x) = \sum_{n=-\infty}^{\infty} c_n e^{i n\pi x/L}, \qquad c_n = \frac{1}{2L}\int_{-L}^{L} f(x)\,e^{-i n\pi x/L}\,dx.

From series to the Fourier transform

You can think of a non-periodic function as a periodic one whose period is infinitely long. As L→∞L \to \infty, the separate frequencies nπ/Ln\pi/L blend into a continuous variable ω\omega, and the sum turns into an integral. This works when ff is piecewise continuous, has left and right derivatives everywhere, and is absolutely integrable (∫−∞∞∣f(x)∣ dx\int_{-\infty}^{\infty}|f(x)|\,dx exists). What you get is the Fourier transform pair:

f^(ω)=12π∫−∞∞f(x) e−iωx dx,f(x)=12π∫−∞∞f^(ω) eiωx dω.\hat f(\omega) = \frac{1}{\sqrt{2\pi}}\int_{-\infty}^{\infty} f(x)\,e^{-i\omega x}\,dx, \qquad f(x) = \frac{1}{\sqrt{2\pi}}\int_{-\infty}^{\infty} \hat f(\omega)\,e^{i\omega x}\,d\omega.

Here ω\omega is angular frequency and f^(ω)\hat f(\omega) is a complex number for each ω\omega. Its size is the amplitude spectrum and its angle is the phase spectrum. (Other books put the 2π2\pi factors in different places, but the ideas are the same.)

Why it’s called a spectrum

Read the inverse transform from right to left. It says f(x)f(x) is a stack of oscillations eiωxe^{i\omega x}, one for every frequency ω\omega, each weighted by f^(ω)\hat f(\omega). A prism does the same thing with white light: it splits it into colours, and each colour is a frequency. White light is the sum of its colours. So in this picture ff is the white light, the Fourier transform is the prism, and f^(ω)\hat f(\omega) is the set of colours with how strong each one is. That’s why f^\hat f is called the spectral representation of ff.

The squared size ∣f^(ω)∣2|\hat f(\omega)|^2 is the spectral density. Its integral over all frequencies is proportional to the total energy of the signal, and its integral from aa to bb tells you how much the frequencies between aa and bb contribute.

The spring shows where this comes from. For a mass mm on a spring with constant kk, Newton’s law gives my¨+ky=0m\ddot y + k y = 0. Multiplying by y˙\dot y and integrating gives

12my˙2+12ky2=E,\tfrac{1}{2}m\dot y^2 + \tfrac{1}{2}k y^2 = E,

so kinetic plus potential energy equals a constant EE. The solution is y=Acos⁡(ω0t+θ)y = A\cos(\omega_0 t + \theta) with ω0=k/m\omega_0 = \sqrt{k/m}. Plugging it in gives E=12kA2E = \tfrac{1}{2}kA^2: energy is proportional to the amplitude squared. A more complicated system whose motion is a Fourier series has one of these terms per frequency, so the total energy is a sum of squared amplitudes over a discrete spectrum. The Fourier transform stretches this idea to a continuous spectrum.

import numpy as np

fs = 1000                       # sampling rate (Hz)
t = np.arange(0, 2, 1/fs)   # 2 s, so 12.5 Hz falls exactly on a frequency bin
# 12.5 Hz cosine, plus a 25 Hz cosine delayed by a quarter period
y = 0.8*np.cos(2*np.pi*12.5*t) + 0.4*np.cos(2*np.pi*25*t - np.pi/2)

Y = np.fft.rfft(y) / (len(y)/2)          # scale so peaks equal amplitudes
f = np.fft.rfftfreq(len(y), 1/fs)
for k in np.argsort(np.abs(Y))[-2:]:
    print(f"{f[k]:5.1f} Hz  amplitude {abs(Y[k]):.2f}  phase {np.degrees(np.angle(Y[k])):6.1f} deg")

The output finds both pieces again: 0.800.80 at 12.512.5 Hz with phase 0°0°, and 0.400.40 at 2525 Hz with phase −90°-90°.

Key takeaways

  • Amplitude, frequency and phase are all you need to describe a single sinusoid. Frequency is 1/T1/T, and wavenumber is 1/λ1/\lambda.
  • Phase is minus the phase lag: a wave that starts late has a negative phase.
  • Fourier series write periodic signals as sums of orthogonal sines and cosines. The Fourier transform extends this to signals that don’t repeat.
  • The size of the transform is the amplitude spectrum, its angle is the phase spectrum, and the squared size shows how the energy is spread over frequency.

Resources

  • Öz Yilmaz, Seismic Data Processing, SEG Investigations in Geophysics No. 2, 1987, Chapter 1 (fundamentals of signal processing). The expanded 2001 edition, Seismic Data Analysis, is free on the SEG Wiki: https://wiki.seg.org/wiki/Seismic_Data_Analysis.
  • Erwin Kreyszig, Advanced Engineering Mathematics, Wiley, chapter “Fourier Analysis” (Fourier series, Euler formulas, orthogonality, Fourier integral and transform, and the spectrum and energy of a spring–mass system).