Skip to content
Tutorials Center
My learning

Topics

Lesson 13 of 38 ยท DFT and FFT

DFT Properties, Leakage and Zero Padding

Learn the key DFT properties (shift, convolution theorem, circular vs linear convolution) and how spectral leakage, windowing and zero padding shape what you see.

You can now compute spectra. This lesson explains why they sometimes look different from what you expect: tones that smear across many bins, frequencies that fall "between" bins, and convolutions that wrap around. All of these come from the same fact: the DFT treats your finite record as one period of an endless, repeating signal.

Useful properties

Time domain DFT domain
a x + b y a X + b Y (linearity)
Circular shift by m X[k] * e^(-j 2 pi k m / N) (a phase ramp; magnitudes unchanged)
Multiply by e^(j 2 pi m n / N) Spectrum shifts by m bins (modulation)
Circular convolution x ~* h X[k] * H[k]
Real signal X[N-k] = conj(X[k])
Even real signal Real spectrum
Time reversal Index reversal in k

The shift property shows that delaying a signal does not change its magnitude spectrum, only the phase.

Python Circular shift only changes the phase

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Circular versus linear convolution

Multiplying DFTs gives circular convolution: the result wraps around modulo N. Ordinary (linear) convolution of lengths L and M is L + M - 1 long. They agree only if the DFT length is at least L + M - 1; zero-pad both inputs to that length first.

Python Convolution theorem with and without padding

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The first two outputs of the N = 4 result are corrupted because the tail of the answer (the last two samples) wrapped around onto the start. Padding to L + M - 1 removes the problem. This is the basis of fast convolution.

Spectral leakage

A sinusoid appears as a single clean spike only when it completes a whole number of periods in the record, i.e. its frequency is exactly on a bin. Otherwise the repeated record has a jump where the end meets the beginning, and the energy leaks into neighbouring bins.

Python On-bin versus off-bin sinusoid

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The on-bin tone fills exactly one bin with its full amplitude. The off-bin one is spread over many bins, and its true peak is under-reported (the "scalloping loss").

Windowing

The cure is to taper the record smoothly to zero at both ends so there is no jump. A window w[n] is multiplied with the data before the FFT. Popular windows are Hann (a good all-round choice), Hamming, Blackman (very low leakage) and Kaiser (adjustable).

There is a trade-off: tapering lowers the far-away leakage (sidelobes) but widens the main lobe, so close frequencies are harder to separate. The rectangular window (no tapering) has the narrowest main lobe and the worst sidelobes.

Python Windows reduce leakage

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The quiet tone has amplitude 0.001, which is -60 dB. With the rectangular window the leakage of the loud tone at 250 Hz is -56.7 dB, as large as the quiet tone, so the two cannot be told apart (the level at 300 Hz is the same -56.7 dB). With Hann or Blackman the far leakage falls below -140 dB, and the quiet tone appears cleanly at 300 Hz at -60 dB. You will use windows again to design filters (the window method).

Zero padding

Appending zeros to a record before the FFT gives more output bins. It does not add information or improve the true resolution (which depends on the record length N). What it does is interpolate the spectrum, so the peak position and shape become easier to read on a plot or to locate.

Python Zero padding gives a smoother view, not better resolution

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Padding pins the single tone near 123 Hz. For the two close tones, only the longer record resolves them (two peaks), however much you pad the short one.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does a circular shift of a signal do to its DFT magnitude?

    A shift multiplies X[k] by a unit-magnitude phase factor.
  2. 2. To get linear convolution of lengths L and M by multiplying DFTs, the DFT length must be at least:

    That is the length of the linear convolution; shorter lengths wrap around and corrupt the result.
  3. 3. Why does an off-bin sinusoid leak?

    The DFT assumes the record repeats; a mismatch at the ends is a discontinuity with a wide spectrum.
  4. 4. What does zero padding improve?

    It interpolates the spectrum. Resolution is set by the length of the real data.

Summary

  • The DFT assumes the record repeats forever: shifts are circular and convolution is circular.
  • A time shift changes only phase; multiplying by a complex exponential shifts the spectrum.
  • Zero-pad to at least L + M - 1 to get linear convolution through the DFT.
  • A tone off a bin leaks; windows (Hann, Blackman) lower the leakage at the cost of a wider main lobe.
  • Zero padding interpolates; only a longer record improves resolution.

Next: FIR Basics and the Moving Average