Lab · Lesson 5
Leakage and windows
Derive why a tone between two FFT bins leaks into all of them, what a Hann window does about it and the ×2 correction, then work one pump signal both ways on a calculator.
Read the whole lesson as notes · every step, derivation and worked example, on one page
1Goal Where we are going
One clean tone should give one clean line in a spectrum. Often it gives a blurred hill instead. This lesson derives exactly why, and what a window does about it, then works one pump signal through both ways.
By the end of this lesson we will have derived why a tone that falls between two FFT bins leaks into all of them, and by how much:
what a Hann window does to the same tone (after the ×2 correction every analyser applies):
Here is the number of cycles of the tone in the record, and is the bin. Then we solve one pump signal twice on a calculator, with and without the window.
2What we already know The tools
Five facts, lettered (A) to (E). The one doing most of the work is (C), the sum of a geometric series.
On the board: the terms of that sum are arrows, each turned a little more than the last. Drag the slider. When the total turn is a whole number of circles, the arrows close into a loop and the sum is zero.
From Lesson 4, (25): the DFT of samples, and the peak an analyser shows:
Euler’s formula, turned round to give a cosine as two arrows:
The sum of a geometric series, for any :
One minus an arrow. Take out , then use :
For a small angle (in radians):
And for a whole number : , , .
3Derivation A tone into the DFT
Write the tone as two arrows and put one of them into the DFT. Out comes a geometric series: arrows, each turned by the same small step.
The step depends on : how far the tone is from the bin you are computing.
Take one tone of amplitude that completes cycles in the record. need not be a whole number:
By (B), it is two arrows turning opposite ways:
Put the first arrow into (A). The exponents add:
The second arrow gives the same sum with in place of . For a bin near , that is far from zero and it adds very little, so we set it aside. (It matters only when is close to 0 or to .)
The sum in (3) is a geometric series (C), with
On the board: each term is an arrow of length 1, turned a little more than the last. Laid tip to tail, they curl round.
4Derivation A whole number of cycles
If the tone fits the record exactly, the arrows either all line up (in its own bin) or close into a loop (in every other bin).
Slide through whole numbers on the board: one bar, nothing else.
First case: is a whole number. In the bin , every exponent in (3) is zero, so every term is 1 and the sum is :
In any other bin, is a whole number that is not zero. Then , but by (4) , so (C) gives
A tone that fits the record exactly lands in one bin and nowhere else. No leakage.
5Derivation Between two bins
If the tone doesn’t fit, the arrows never close, and every bin gets a share. The geometric series gives the share exactly; for large it simplifies to .
On the board, the open circles are that formula; the bars are the exact FFT of 64 samples. They agree closely, except near the edges where the other arrow matters.
Second case: is not a whole number. Write for the distance from the tone to bin . By (C) and (4):
Use (D) on the top (with ) and on the bottom (with ). The cancels:
is large, so is a small angle: by (E), and :
Substitute (9) in (3). The ’s cancel:
Take the size and double it, as in (A). :
Every bin gets something. Far from the tone, , so the leak falls only like : slowly.
The worst case is exactly halfway, , where the two nearest bins both read
6What it means The jump at the seam
The FFT treats the record as if it repeated. If the tone doesn’t fit, the end of one copy doesn’t meet the start of the next: there is a jump at every seam, and a jump needs many frequencies.
Slide , and switch the window on to see the seams close.
Why does a tone that doesn’t fit behave so differently? The DFT treats the record as one period of a repeating signal (Lesson 4). Compare the two ends of the record in (1), with :
If is a whole number, and the ends meet. Otherwise there is a jump at every seam. A jump is a sharp edge, and by Lesson 2, (14), sharp edges need harmonics that fall off only like . That is the same slow as in (11).
7Derivation The Hann window is three arrows
A Hann window is a constant minus a cosine, and a cosine is two arrows. Multiplying a signal by an arrow shifts its whole spectrum by one bin.
So windowing never needs a new FFT: each new bin is half the old bin, minus a quarter of each neighbour.
The fix is to fade the record in and out so the ends meet at zero. The Hann window is
By (B), the cosine is two arrows, so the window is three terms:
What does multiplying a signal by do to its DFT? Put it into (A):
In the same way gives . So the DFT of the windowed record , call it , is by (15) and (16)
8Derivation A tone on a bin, through the window
Even a tone that fits perfectly is changed by the window: its bin reads half, and its two neighbours each pick up a quarter. Analysers multiply by 2 to put the peak right.
The board shows the corrected spectrum: the right peak, with two neighbours at half height.
Try (17) on a tone that fits the record, . By (5) and (6), and every other :
Two things happened. First, the peak reads half what it should:
So an analyser multiplies a Hann-windowed spectrum by 2, the amplitude correction. (2 is one over the average height of the window, which is by (14).) After correction:
Second, the tone now occupies three bins, not one. That is the price of a window: a wider peak.
9Derivation Why the far leak collapses
Without a window, neighbouring bins of a leaking tone are nearly equal. The window subtracts half the average of the neighbours from each bin, so far from the tone almost everything cancels.
Switch between the two on the board. Open circles are the formulas.
Now the tone between bins. Look again at (10). Moving one bin changes by 1, which by the tools flips the sign of and of : two flips, so their product does not change. So across the bins
The neighbours are and . Substitute in (17):
Combine the last two fractions: . Then put everything over :
Take the size, double it as in (A), and apply the ×2 correction of (20):
Far from the tone this falls like , not . Five bins away it is about 25 times smaller than without the window.
And the worst case, halfway (), is much milder than (12):
10Worked example 1 A pump at 1490 rpm, no window
A 5 mm/s vibration at 24.83 Hz, a 1-second record, no window. Bin by bin on a calculator: where the peak appears, how low it reads, and how far the leak reaches.
Worked example 1. A pump runs at 1490 rpm with a 1X vibration of mm/s. The analyser takes a 1-second record with no window. What does the spectrum show?
The bins are Hz apart, so the number of cycles in the record equals the frequency in hertz. From Lesson 1, (13):
The top of (11) is the same for every bin, since moving one bin only flips the sign of the sine. Work it out once (calculator in radians, or ):
Now (11), bin by bin:
So the analyser shows its tallest peak at 25 Hz, reading
with false peaks of 0.98 and 0.69 mm/s beside it, and 0.16 mm/s still showing five bins away. A small real component near 30 Hz would be hidden under that.
11Worked example 2 The same pump, with a Hann window
Same signal, same record, Hann window on. The peak reads closer to 5 mm/s and the far bins drop out, at the cost of a wider peak.
Worked example 2. The same pump and the same record, now with a Hann window (and the analyser’s ×2 correction).
Use (24) with the same values, and from (27). The only new part is :
Compare with example 1:
The price shows in bins 24 and 26: 3.14 and 1.88 mm/s, higher than before. The peak is wider, as (20) said it would be. For reading a machine spectrum that is a good trade: the amplitude is closer and nothing is buried.
12Your turn Try it with a calculator
Your turn. In the interactive lesson above, this step gives you a new signal each time, checks your answers and writes out the full working, line by line.
13Summary On one card
Four boxed results, each derived above. A tone on a bin is exact; a tone between bins leaks like ; a Hann window turns that into and is corrected by ×2.
Next: Lesson 6, wavelets, for signals that change over time.
Everything in this lesson on one card ( is the distance from the tone to the bin, in bins):
Leakage falls like without a window and like with a Hann window. The price is a peak three bins wide.