HuntsvilleEngineers mark
HE Reference Shelf — huntsvilleengineers.com
The Reference Shelf · Applied Engineering Math

Window functions

A window is the taper you multiply onto a signal record before the FFT so the chopped-off ends don't smear energy across the whole spectrum — and every window trades amplitude accuracy against frequency resolution.

Also known as: Hann window · Hamming window · Blackman window · flat-top window · tapering

The formula

The general move — multiply the record by a taper before transforming:

x_w[n] = x[n] · w[n],    n = 0 … N−1

Reading: the FFT never sees your signal; it sees your signal times the window, and the displayed spectrum is the true spectrum convolved with the window's own spectrum.

The Hann window (the everyday default):

w[n] = 0.5 − 0.5·cos(2πn/N) = sin²(πn/N)

Reading: a raised cosine that starts at zero, peaks at 1 mid-record, and returns to zero — the ends of the record are faded out so the periodic wraparound has no discontinuity.

The Hamming window (Hann's near twin, different aim):

w[n] = 0.54 − 0.46·cos(2πn/N)      (exact optimum: 25/46 ≈ 0.5435)

Reading: instead of tapering to zero, it stops at 0.08 — the pedestal is tuned to cancel the first sidelobe, buying about 11 dB there at the cost of a high sidelobe floor everywhere else.

The Blackman window (one more cosine term, more suppression):

w[n] = 0.42 − 0.5·cos(2πn/N) + 0.08·cos(4πn/N)

Reading: each added cosine term buys deeper sidelobes and pays for it with a wider main lobe.

The two correction factors every analyzer applies for you (and every homemade script forgets):

amplitude correction = N / Σ w[n]              (Hann: 2.000, i.e. +6.02 dB)
ENBW = N · Σ w[n]² / (Σ w[n])²   in bins       (Hann: 1.50 bins, i.e. +1.76 dB on noise)

Reading: the first fixes the height of a sine peak, the second fixes the power of broadband noise — they are different numbers, and using the wrong one is the classic 1.8 dB bust.

Where you meet it

  • On a dynamic signal analyzer at the vibe bench. The window menu says Uniform, Hanning, Flattop. Hanning for surveying a random vibration spectrum; Flattop when you're calibrating an accelerometer against a shaker running a single sine and the amplitude number has to be right to hundredths of a dB.
  • At the modal test stand with an impact hammer. A hammer tap that fully decays inside the record needs no taper at all — the uniform (rectangular) window is correct. Hann applied out of habit multiplies the front of your transient by nearly zero and quietly deletes the data you drove out to the test stand to get.
  • On the ADC characterization bench. Measuring SINAD and ENOB with a tone that can't be coherently sampled means windowing, and the window's main-lobe width decides how many bins around the carrier you must exclude before summing noise power. Get the ENBW accounting wrong and your ENOB moves by half a bit.
  • At the data review board. Two groups measure the same tone; one reports it 1.4 dB lower. Nobody's instrument is broken — one tone sat mid-bin, the other sat between bins, and Hann's worst-case scalloping loss is 1.42 dB. The window, not the hardware, is the finding.

How it works

The DFT silently assumes your N-sample record repeats forever. If the record holds a non-integer number of signal cycles, the imagined repetition has a step discontinuity at the seam, and a step has energy at every frequency — that's spectral leakage, and it can bury a small tone 60 dB down under the skirt of a big one. A window forces the record's ends toward zero so the seam disappears. The price is fixed by Fourier: shortening the effective record widens every spectral line.

The numbers that matter, verified numerically (N = 1024):

window       highest sidelobe   ENBW (bins)   worst scalloping   amplitude corr.
uniform          −13.3 dB          1.00           3.92 dB             1.00
Hann             −31.5 dB          1.50           1.42 dB             2.00
Hamming (0.54)   −42.7 dB          1.36           1.75 dB             1.85
Blackman         −58.1 dB          1.73           1.10 dB             2.38
flat-top (5-term) −93.0 dB         3.77           0.01 dB             4.64

Read the table as one trade: sidelobe suppression and amplitude flatness are bought with main-lobe width. The flat-top window is the extreme case — its main lobe is engineered to be nearly level across a full bin, so a tone reads correctly (within 0.01 dB) no matter where it lands between bins, but the lobe is almost four bins wide and two tones closer than that merge into one bump. Hann versus Hamming is a subtler split: Hamming's first sidelobe is 11 dB lower, but its sidelobes decay at only 6 dB per octave against Hann's 18, so far from the carrier Hann is dramatically cleaner — which one wins depends on whether the interference you fear is next door or across town.

The mistakes people actually make:

  1. No correction factor. A Hann-windowed sine reads 6.02 dB low raw. Commercial analyzers correct silently; the Python script somebody wrote on second shift does not.
  2. Amplitude correction applied to noise. Sine peaks need the coherent-gain correction; noise power needs division by ENBW. Apply the sine correction to a noise floor and you're off by the difference — about 1.8 dB for Hann. PSD plots that don't match between two tools almost always die on this hill.
  3. Windowing a transient. Shock, pyro, and impact data that starts and ends inside the record is already leakage-free. Tapering it destroys amplitude information; on decaying responses the standard practice is an exponential window applied deliberately, with the added damping backed out afterward.
  4. Flat-top for resolution work. Trying to separate two mechanical resonances 2 Hz apart with a flat-top window and a 1 Hz bin spacing is hopeless — the main lobe alone spans nearly 4 Hz. Amplitude windows and resolution windows are different tools.
  5. Forgetting overlap. A Hann taper throws away the information at the record ends. Averaging with 50–75 % overlap between successive records recovers it nearly for free; averaging non-overlapped Hann records wastes roughly a third of your test time.

Limits of validity: window figures of merit assume a stationary signal across the record and a taper applied to the full record length. None of the table numbers mean anything on a swept sine, a chirp, or a record with the window applied to only part of it.

History

The name chain here is one of engineering's better jokes. Julius von Hann (1839–1921) was an Austrian meteorologist who never touched a spectrum in his life — he smoothed weather-station data with a ¼, ½, ¼ weighted moving average, and that three-point smoother is exactly what the raised-cosine window does to adjacent DFT bins [1][2]. When R. B. Blackman and John Tukey of Bell Labs wrote The Measurement of Power Spectra (1958), the book that made windowed spectral estimation standard practice, they turned his name into a verb — "hanning" a record — and the gerund stuck so hard that half the industry still believes the window was invented by someone named Hanning [2][3].

The confusion was helped along by Richard Hamming (1915–1998), Tukey's actual Bell Labs colleague, whose nearly identical window differs only in leaving a 0.08 pedestal at the ends to cancel the first sidelobe [4][5][8]. Blackman's own name landed on the three-term window from the same book [6]. So the field's two most-confused window names belong to an Austrian weatherman dead since 1921 and a living colleague down the hall — differing by a coefficient of 0.04.

The trade-space itself got its definitive map in 1978, when Fredric Harris published "On the Use of Windows for Harmonic Analysis with the Discrete Fourier Transform" in the Proceedings of the IEEE — a catalog of dozens of windows with their sidelobe levels, ENBW, scalloping loss, and worst-case processing loss tabulated side by side [7]. Nearly fifty years on, the window menu on every FFT analyzer is still a subset of Harris's table.

Related tools

Sources

  1. https://en.wikipedia.org/wiki/Julius_von_Hann
  2. https://en.wikipedia.org/wiki/Hann_function
  3. https://numpy.org/doc/stable/reference/generated/numpy.hanning.html
  4. https://en.wikipedia.org/wiki/Richard_Hamming
  5. https://numpy.org/doc/stable/reference/generated/numpy.hamming.html
  6. https://numpy.org/doc/stable/reference/generated/numpy.blackman.html
  7. https://www.cs.cmu.edu/afs/cs/user/bhiksha/WWW/courses/dsp/spring2013/WWW/schedule/readings/windows_comparison2_harris.pdf
  8. https://en.wikipedia.org/wiki/Window_function

Written by HE in our own words from the cited sources — engineering judgment included, your stamp still required. All entries →

★ The Reference Shelf

Reading is free. The shelf is for cardholders.

Your library card is an email address: pin it to your shelf, print the card, take the FE/PE quick-reference pack, read the Huntsville history. The shelf remembers what you reach for.

Already on the list? Enter with your subscribed email →