TExcelTAD
Home › Signals, Systems & Digital Filters for Engineers › Noise and Spectral Estimation: Periodogram and Welch

Noise and Spectral Estimation: Periodogram and Welch

An amplifier's datasheet says its output noise is 14 nV/Hz14\ \text{nV}/\sqrt{\text{Hz}}. You record its output, take an FFT and get a jagged carpet whose height depends on how many points you used: double the record length and every bin drops by 3 dB3\ \text{dB}, yet the noise has not changed. Tones and noise behave differently in an FFT, and noise needs two things a plain FFT does not give: a density scaling (volts per root hertz), and averaging, because a single FFT of noise is itself a random variable with 100 %100\,\% scatter in every bin. This lesson covers the periodogram, Welch's method, units, and how to read a tone and a noise floor from the same spectrum. Background: Power Spectrum for the theory and Spectrum Analysers for the instrument with its resolution bandwidth.

Power spectral density

For a stationary random signal the meaningful quantity is the power spectral density (PSD) Sx(f)S_x(f), in V2/Hz\text{V}^2/\text{Hz}: the power per unit bandwidth. Its integral over a band gives the mean-square voltage in that band, and its square root is the noise density in V/Hz\text{V}/\sqrt{\text{Hz}} that datasheets quote:

σ[f1,f2]2=∫f1f2Sx(f) df,white noise: Sx=σ2fs/2  (one-sided)\sigma^2_{[f_1, f_2]} = \int_{f_1}^{f_2} S_x(f)\,df, \qquad \text{white noise: } S_x = \frac{\sigma^2}{f_s/2}\ \ (\text{one-sided})

Contrast this with a tone: a sinusoid's power sits at one frequency, so its height in a power spectrum (in V2\text{V}^2, scaling='spectrum') is independent of the bin width, while noise in the same plot scales with the bin's equivalent noise bandwidth ENBW⋅fs/N\text{ENBW} \cdot f_s/N. In a density plot it is the other way round: noise is flat and the tone's height grows with NN. Neither view is wrong; you must just say which you show.

The periodogram and its problem

The periodogram is the scaled squared magnitude of one windowed FFT:

S^[k]=2 ∣Xw[k]∣2fs∑nw[n]2\hat S[k] = \frac{2\,\lvert X_w[k] \rvert^2}{f_s \sum_n w[n]^2}

It is unbiased for white noise, but its standard deviation equals its mean, whatever NN is: more samples give more bins, not smoother ones. Welch's method splits the record into KK overlapping segments (typically 50 %50\,\% overlap, Hann window), computes a periodogram of each and averages them. The scatter falls roughly as 1/K1/\sqrt{K}; the price is resolution, since each segment is shorter (Resolution).

Worked example: an amplifier's noise floor and a test tone

Given: an amplifier output digitised at fs=10 kSa/sf_s = 10\ \text{kSa/s} for 65 53665\,536 samples (6.55 s6.55\ \text{s}): white noise of 1 mV1\ \text{mV} rms over 00 to 5 kHz5\ \text{kHz} plus a 10 mV10\ \text{mV} peak test tone at 1 kHz1\ \text{kHz}.

Find: the noise density, the noise in a 100 Hz100\ \text{Hz} band, the tone's rms value, and the scatter of a single periodogram versus Welch with 1000-point segments.

Solve: S=(1 mV)2/5000 Hz=2×10−10 V2/HzS = (1\ \text{mV})^2/5000\ \text{Hz} = 2 \times 10^{-10}\ \text{V}^2/\text{Hz}, density S=14.1 μV/Hz\sqrt{S} = 14.1\ \mu\text{V}/\sqrt{\text{Hz}}. In 100 Hz100\ \text{Hz}: 14.1 μV×100=141 μV14.1\ \mu\text{V} \times \sqrt{100} = 141\ \mu\text{V} rms. The tone is 10/2=7.07 mV10/\sqrt{2} = 7.07\ \text{mV} rms. Welch with 1000-point segments (10 Hz10\ \text{Hz} bins, so the tone falls exactly on a bin) and 50 %50\,\% overlap uses K=130K = 130 segments; the scatter should drop from about 100 %100\,\% to roughly 1/130=8.8 %1/\sqrt{130} = 8.8\,\% (overlapping Hann segments are not fully independent, but 50 %50\,\% overlap loses little).

Check: the program estimates all four.

python · try it yourself
import numpy as np
from scipy import signal

rng = np.random.default_rng(11)
fs, N = 10_000, 65_536
t = np.arange(N) / fs
x = 1e-3 * rng.standard_normal(N) + 10e-3 * np.sin(2 * np.pi * 1000 * t)

f1, P1 = signal.periodogram(x, fs, window="hann")                    # one long periodogram, V^2/Hz
f2, P2 = signal.welch(x, fs, window="hann", nperseg=1000)            # 50 % overlap by default
noise1 = (f1 > 200) & (np.abs(f1 - 1000) > 50) & (f1 < 4800)
noise2 = (f2 > 200) & (np.abs(f2 - 1000) > 50) & (f2 < 4800)
for name, f, P, m in (("periodogram", f1, P1, noise1), ("Welch 1000", f2, P2, noise2)):
    print(f"{name:12s}: density {1e6 * np.sqrt(np.mean(P[m])):.2f} uV/rtHz, "
          f"scatter (std/mean) {np.std(P[m]) / np.mean(P[m]):.3f}, bin width {f[1]:.3f} Hz")
print(f"segments averaged: {1 + (N - 1000) // 500}")

band = (f2 >= 2000) & (f2 < 2100)
print(f"noise in 2000..2100 Hz: {1e6 * np.sqrt(np.sum(P2[band]) * (f2[1] - f2[0])):.0f} uV rms (expected 141)")

f3, S3 = signal.welch(x, fs, window="hann", nperseg=1000, scaling="spectrum")   # V^2 per bin: tones read right
print(f"tone from 'spectrum' scaling: {1e3 * np.sqrt(S3.max()):.2f} mV rms at {f3[np.argmax(S3)]:.1f} Hz")
periodogram : density 14.15 uV/rtHz, scatter (std/mean) 1.007, bin width 0.153 Hz
Welch 1000  : density 14.13 uV/rtHz, scatter (std/mean) 0.089, bin width 10.000 Hz
segments averaged: 130
noise in 2000..2100 Hz: 138 uV rms (expected 141)
tone from 'spectrum' scaling: 7.07 mV rms at 1000.0 Hz

Both estimates agree on the density, but the single periodogram's bins scatter by 100 %100\,\% while Welch's scatter by 8.9 %8.9\,\%. The band integral gives 138 μV138\ \mu\text{V} against the expected 141141 (ten bins of a noisy estimate), and the 'spectrum' scaling reads the tone's rms value, 7.07 mV7.07\ \text{mV}, directly. Had the tone fallen between bins it would read up to 1.42 dB1.42\ \text{dB} low, the Hann scalloping loss.

Reading a real noise spectrum

python · try it yourself
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt

# Amplifier-like noise: white floor plus 1/f (flicker) noise below a 100 Hz corner, plus 50 Hz hum
rng = np.random.default_rng(4)
fs, N = 10_000, 2**16
white = rng.standard_normal(N)
F = np.fft.rfftfreq(N, 1 / fs)
shape = np.sqrt(1 + 100 / np.maximum(F, 1.0))                # density^2 rises as 1/f below 100 Hz
pink = np.fft.irfft(np.fft.rfft(white) * shape, N)
x = 14.14e-6 * np.sqrt(fs / 2) * pink + 2e-3 * np.sin(2 * np.pi * 50 * np.arange(N) / fs)

f, P = signal.welch(x, fs, nperseg=4096)
d = np.sqrt(P)
for fq in (10, 100, 1000):
    k = np.argmin(abs(f - fq))
    print(f"density at {fq:5d} Hz: {1e6 * np.median(d[k - 2:k + 3]):6.1f} uV/rtHz")

plt.figure(figsize=(7, 3))
plt.loglog(f[1:], 1e6 * d[1:])
plt.xlabel("f (Hz)"); plt.ylabel("uV/sqrt(Hz)"); plt.title("Welch PSD: 1/f region, white floor, 50 Hz hum")
plt.tight_layout(); plt.show()
density at    10 Hz:   51.9 uV/rtHz
density at   100 Hz:   20.3 uV/rtHz
density at  1000 Hz:   15.2 uV/rtHz

On a log-log plot, white noise is flat, flicker noise power grows by 10 dB10\ \text{dB} per decade towards low frequencies (1/f1/\sqrt{f} in density), and the hum is a spike whose height depends on the segment length because it is a tone, not noise. The model's corner frequency is 100 Hz100\ \text{Hz}, where flicker and white noise are equal and the density is 2×14.1=20.0 μV/Hz\sqrt{2} \times 14.1 = 20.0\ \mu\text{V}/\sqrt{\text{Hz}} (the estimate reads 20.320.3); at 10 Hz10\ \text{Hz} the model gives 14.111=46.914.1\sqrt{11} = 46.9 and the estimate 51.951.9, within the scatter of the few low-frequency bins. The corner is a standard op-amp parameter (Noise).

Practical rules

  • Pick nperseg from the resolution you need (≈2fs/nperseg\approx 2f_s/\text{nperseg} for Hann), then use the longest record you can afford to get many segments.
  • Use scaling='density' for noise, scaling='spectrum' for tones, and say which.
  • Use detrend (default 'constant') or remove the mean, or DC leaks into the lowest bins.
  • To compare with a spectrum analyser, convert: noise power in its resolution bandwidth =S×RBW= S \times \text{RBW} (and the analyser's own noise-bandwidth corrections).
  • Report dBV/Hz\text{dBV}/\sqrt{\text{Hz}} or V/Hz\text{V}/\sqrt{\text{Hz}}, never "dB" alone.

Guided lab: the noise floor of an audio interface

Hand calculation. An ideal 16-bit converter with ±1 V\pm 1\ \text{V} full scale has q=30.5 μVq = 30.5\ \mu\text{V}, quantisation noise 8.8 μV8.8\ \mu\text{V} rms, spread over 24 kHz24\ \text{kHz} at 48 kSa/s48\ \text{kSa/s}: 8.8/24 000=57 nV/Hz8.8/\sqrt{24\,000} = 57\ \text{nV}/\sqrt{\text{Hz}}.

Simulation. Replace x in the first program by q * np.round(1e-3 * rng.standard_normal(N) / q) with q = 2 / 65536 and see that the noise you add dominates; then set the noise to zero and a tiny 1 LSB1\ \text{LSB} tone with dither to see the quantisation floor.

What you would measure. Short the interface's input (or terminate it with 50 Ω50\ \Omega), record 10 s at 48 kSa/s48\ \text{kSa/s} and run Welch with nperseg=4096. Real interfaces are usually above the ideal quantisation floor because of analog noise; expect a flat floor of order 0.10.1 to 1 μV/Hz1\ \mu\text{V}/\sqrt{\text{Hz}} (consult your device's dynamic-range specification), mains-related lines at 5050 or 60 Hz60\ \text{Hz} and harmonics if a laptop charger is attached, and a rise below a few tens of hertz. Repeat with only the battery: the lines usually shrink. Welch's estimate of the floor scatters by about ±1/K\pm 1/\sqrt{K} for KK segments.

Hazards and safe setup. Nothing but the interface and a shorting plug or a resistor; run the laptop from its battery if you want to see the difference, and never open a charger.

Pitfalls

  • Reading noise from an amplitude spectrum and quoting it in volts (it depends on the bin width).
  • Expecting a longer single FFT to give a smoother noise floor.
  • Comparing densities computed with different windows without the ENBW correction (Welch does it for you; a hand-rolled FFT does not).
  • Treating mains hum as noise: it is a tone and must be read with the spectrum scaling.

Practice

  1. White noise of 5 mV5\ \text{mV} rms is sampled at 50 kSa/s50\ \text{kSa/s}. What is its one-sided density?
  2. A density of 20 nV/Hz20\ \text{nV}/\sqrt{\text{Hz}} is integrated over 20 Hz20\ \text{Hz} to 20 kHz20\ \text{kHz}. What rms noise results?
  3. You average K=64K = 64 Welch segments. Roughly how much does a bin of the estimate scatter?
Answer
  1. S=(5 mV)2/25 000 Hz=10−9 V2/HzS = (5\ \text{mV})^2/25\,000\ \text{Hz} = 10^{-9}\ \text{V}^2/\text{Hz}, so S=31.6 μV/Hz\sqrt{S} = 31.6\ \mu\text{V}/\sqrt{\text{Hz}}.
  2. 20 nV×19 980=2.83 μV20\ \text{nV} \times \sqrt{19\,980} = 2.83\ \mu\text{V} rms.
  3. About 1/64=12.5 %1/\sqrt{64} = 12.5\,\% (a little more with overlapping Hann segments), i.e. about ±0.5 dB\pm 0.5\ \text{dB}.

Test yourself

The unit of a noise density on a datasheet is

  1. V
  2. V/Hz
  3. V/Hz\text{V}/\sqrt{\text{Hz}}
  4. dB

Doubling the length of a single periodogram of white noise

  1. halves the scatter of each bin
  2. leaves the scatter of each bin at about 100 %
  3. halves the density
  4. doubles the density

White noise of 1 mV rms sampled at 10 kSa/s has a one-sided density of

  1. 1 mV/Hz1\ \text{mV}/\sqrt{\text{Hz}}
  2. 14.1 μV/Hz14.1\ \mu\text{V}/\sqrt{\text{Hz}}
  3. 10 μV/Hz10\ \mu\text{V}/\sqrt{\text{Hz}}
  4. 0.2 μV/Hz0.2\ \mu\text{V}/\sqrt{\text{Hz}}

The price of averaging more Welch segments from a fixed record is

  1. more bias
  2. poorer frequency resolution
  3. a higher noise floor
  4. aliasing