Power Spectral Density (Welch's Method)

March 21, 2026 · View on GitHub

Overview & Motivation

Given a noisy signal, a natural question is: how is the signal's power distributed across frequencies? A single FFT of the entire record gives a very noisy estimate — the variance of the periodogram does not decrease as the record grows. Welch's method trades frequency resolution for statistical reliability by dividing the signal into overlapping, windowed segments, computing a periodogram for each, and averaging them. The result is a smooth, consistent estimate of the Power Spectral Density (PSD).

This is the standard approach in vibration analysis, audio engineering, communication system design, and any domain where reliable spectral estimates matter more than the finest possible frequency resolution.

Mathematical Theory

Power Spectral Density Definition

For a wide-sense stationary process x(t)x(t), the PSD is the Fourier transform of the autocorrelation function (Wiener-Khinchin theorem):

Sxx(f)=Rxx(τ)ej2πfτdτS_{xx}(f) = \int_{-\infty}^{\infty} R_{xx}(\tau) \, e^{-j2\pi f\tau} \, d\tau

In practice we estimate SxxS_{xx} from a finite record.

The Periodogram

The periodogram of a length-NN segment x[n]x[n] is:

P^(fk)=1Nn=0N1x[n]ej2πkn/N2=1NX[k]2\hat{P}(f_k) = \frac{1}{N} \left| \sum_{n=0}^{N-1} x[n] \, e^{-j2\pi kn/N} \right|^2 = \frac{1}{N} |X[k]|^2

This is an unbiased but inconsistent estimator — its variance does not shrink as NN \to \infty.

Welch's Method

  1. Segment the signal of length LL into KK overlapping segments of length NN with step size S=NoverlapS = N - \text{overlap}:

xi[n]=x[n+iS],i=0,1,,K1x_i[n] = x[n + iS], \quad i = 0, 1, \ldots, K-1

  1. Window each segment:

wi[n]=w[n]xi[n]w_i[n] = w[n] \cdot x_i[n]

  1. Compute the periodogram of each windowed segment:

Pi[k]=1NWi[k]2P_i[k] = \frac{1}{N} |W_i[k]|^2

  1. Average across all segments:

S^xx[k]=1Ki=0K1Pi[k]\hat{S}_{xx}[k] = \frac{1}{K} \sum_{i=0}^{K-1} P_i[k]

The averaging reduces variance by a factor of approximately KK (slightly less due to overlap correlation).

Frequency Resolution

Δf=fsN\Delta f = \frac{f_s}{N}

Increasing segment size NN improves resolution but reduces the number of averages KK for a fixed-length record.

Complexity Analysis

CaseTimeSpaceNotes
AllO(KNlogN)O(K \cdot N \log N)O(N)O(N)KK segments, each requiring one FFT

Where K=(LN)/S+1K = \lfloor (L - N) / S \rfloor + 1 and S=N(1overlap fraction)S = N \cdot (1 - \text{overlap fraction}).

Why: Each segment requires an O(NlogN)O(N \log N) FFT, and there are KK segments. The averaging and magnitude-squared operations are O(N)O(N) per segment.

Step-by-Step Walkthrough

Input: x=[1,3,5,7,6,4,2,0]x = [1, 3, 5, 7, 6, 4, 2, 0], segment size N=4N=4, 50 % overlap, rectangular window.

Step 1 — Segmentation (step S=2S = 2):

SegmentIndicesValues
x0x_00–3[1,3,5,7][1, 3, 5, 7]
x1x_12–5[5,7,6,4][5, 7, 6, 4]
x2x_24–7[6,4,2,0][6, 4, 2, 0]

Step 2 — Window (rectangular → no change)

Step 3 — FFT and periodogram for x0=[1,3,5,7]x_0 = [1, 3, 5, 7]:

  • X0=[16,  4+4j,  4,  44j]X_0 = [16, \; -4+4j, \; -4, \; -4-4j]
  • P0=14[256,  32,  16,  32]=[64,  8,  4,  8]P_0 = \frac{1}{4}[256, \; 32, \; 16, \; 32] = [64, \; 8, \; 4, \; 8]

(Repeat for x1x_1 and x2x_2.)

Step 4 — Average the three periodograms element-wise.

Output: One-sided PSD estimate at frequencies $0, \frac{f_s}{4}, \frac{f_s}{2}$.

Pitfalls & Edge Cases

  • Too few segments. If the signal is short relative to the segment size, KK is small and the variance reduction is limited. Reduce NN or increase overlap.
  • Overlap > 75 % gives diminishing returns — the segments become highly correlated and additional averages barely reduce variance.
  • Window choice affects both the main-lobe width and sidelobe level. A Hanning window is a safe default; use Blackman for better dynamic range at the cost of resolution.
  • Segment size must be even (and a power of 2 for the FFT). Odd or non-power-of-2 sizes are rejected at compile time.
  • DC and Nyquist bins appear only once in the one-sided spectrum; all other bins are doubled. Omitting this correction distorts the total power.

Variants & Generalizations

VariantKey Difference
Bartlett's methodNon-overlapping segments, rectangular window (special case of Welch with 0 % overlap)
Modified periodogramSingle segment with a non-rectangular window
Multitaper methodUses multiple orthogonal windows (tapers) per segment for lower bias
Cross-spectral densityComputes SxyS_{xy} between two signals instead of the auto-spectrum
Coherence$

Applications

  • Vibration analysis — Identifying resonant frequencies and tracking their amplitude over time.
  • Noise characterization — Determining white, pink, or brown noise profiles in electronic circuits or sensors.
  • Communication systems — Measuring occupied bandwidth and interference levels.
  • Audio engineering — Equalizer design, room acoustics analysis.
  • Biomedical signal processing — EEG, EMG spectral analysis for clinical diagnostics.

Connections to Other Algorithms

graph LR
    SIG["Input Signal"] --> WIN["Window Functions"]
    WIN --> FFT["Fast Fourier Transform"]
    FFT --> PSD["Power Spectral Density"]
    PSD --> YW["Yule-Walker (parametric alternative)"]
AlgorithmRelationship
Fast Fourier TransformCore building block — each segment is transformed via FFT
Window FunctionsApplied to each segment before FFT to control leakage
Yule-WalkerParametric alternative — estimates PSD from an AR model instead of averaging periodograms

References & Further Reading

  • Welch, P.D., "The use of fast Fourier transform for the estimation of power spectra", IEEE Transactions on Audio and Electroacoustics, 15(2), 1967.
  • Oppenheim, A.V. and Schafer, R.W., Discrete-Time Signal Processing, 3rd ed., Pearson, 2009 — Chapter 10.
  • Stoica, P. and Moses, R.L., Spectral Analysis of Signals, Prentice Hall, 2005.