The Fourier transform of a function of time, <math>s(t)</math>, is a complex-valued function of frequency, <math>S(f)</math>, often referred to as a frequency spectrum. Any linear time-invariant operation on <math>s(t)</math> produces a new spectrum of the form <math>H(f)*S(f)</math>, which changes the relative magnitudes and/or angles (phase) of the non-zero values of <math>S(f)</math>. Any other type of operation creates new frequency components that may be referred to as spectral leakage in the broadest sense. Sampling, for instance, produces leakage, which we call aliases of the original spectral component. For Fourier transform purposes, sampling is modeled as a product between <math>s(t)</math> and a Dirac comb function. The spectrum of a product is the convolution between <math>S(f)</math> and another function, which inevitably creates the new frequency components. But the term 'leakage' usually refers to the effect of windowing, which is the product of <math>s(t)</math> with a different kind of function, the window function. Window functions happen to have finite duration, but that is not necessary to create leakage. Multiplication by a time-variant function is sufficient.

Spectral analysis

The Fourier transform of the function is zero, except at frequency&nbsp;±ω. However, many other functions and waveforms do not have convenient closed-form transforms. Alternatively, one might be interested in their spectral content only during a certain time period. In either case, the Fourier transform (or a similar transform) can be applied on one or more finite intervals of the waveform. In general, the transform is applied to the product of the waveform and a window function. Any window (including rectangular) affects the spectral estimate computed by this method.

The effects are most easily characterized by their effect on a sinusoidal s(t) function, whose unwindowed Fourier transform is zero for all but one frequency. The customary frequency of choice is 0&nbsp;Hz, because the windowed Fourier transform is simply the Fourier transform of the window function itself (see ):

:<math>\mathcal{F}\{ w(t)\cdot \underbrace{\cos(2\pi 0 t)}_{1}\} = \mathcal{F}\{ w(t)\}.</math>

When both sampling and windowing are applied to s(t), in either order, the leakage caused by windowing is a relatively localized spreading of frequency components, with often a blurring effect, whereas the aliasing caused by sampling is a periodic repetition of the entire blurred spectrum.

thumb|350px|Figure 1: Comparison of two window functions in terms of their effects on equal-strength sinusoids with additive noise. The sinusoid at bin −20 suffers no scalloping and the one at bin +20.5 exhibits worst-case scalloping. The rectangular window produces the most scalloping but also narrower peaks and lower noise-floor. A third sinusoid with amplitude −16 dB would be noticeable in the upper spectrum, but not in the lower spectrum.

thumb|350px|Figure 2: Windowing a sinusoid causes spectral leakage, even if the sinusoid has an integer number of cycles within a rectangular window. The leakage is evident in the 2nd row, blue trace. It is the same amount as the red trace, which represents a slightly higher frequency that does not have an integer number of cycles. When the sinusoid is sampled and windowed, its discrete-time Fourier transform also exhibits the same leakage pattern (rows 3 and 4). But when the DTFT is only sparsely sampled, at a certain interval, it is possible (depending on your point of view) to: (1) avoid the leakage, or (2) create the illusion of no leakage. For the case of the blue sinusoid DTFT (3rd row of plots, right-hand side), those samples are the outputs of the discrete Fourier transform (DFT). The red sinusoid DTFT (4th row) has the same interval of zero-crossings, but the DFT samples fall in-between them, and the leakage is revealed.

Choice of window function

Windowing of a simple waveform like causes its Fourier transform to develop non-zero values (commonly called spectral leakage) at frequencies other than ω. The leakage tends to be worst (highest) near ω and least at frequencies farthest from&nbsp;ω.

If the waveform under analysis comprises two sinusoids of different frequencies, leakage can interfere with our ability to distinguish them spectrally. Possible types of interference are often broken down into two opposing classes as follows: If the component frequencies are dissimilar and one component is weaker, then leakage from the stronger component can obscure the weaker one's presence. But if the frequencies are too similar, leakage can render them unresolvable even when the sinusoids are of equal strength. Windows that are effective against the first type of interference, namely where components have dissimilar frequencies and amplitudes, are called high dynamic range. Conversely, windows that can distinguish components with similar frequencies and amplitudes are called high resolution.

The rectangular window is an example of a window that is high resolution but low dynamic range, meaning it is good for distinguishing components of similar amplitude even when the frequencies are also close, but poor at distinguishing components of different amplitude even when the frequencies are far away. High-resolution, low-dynamic-range windows such as the rectangular window also have the property of high sensitivity, which is the ability to reveal relatively weak sinusoids in the presence of additive random noise. That is because the noise produces a stronger response with high-dynamic-range windows than with high-resolution windows.

At the other extreme of the range of window types are windows with high dynamic range but low resolution and sensitivity. High-dynamic-range windows are most often justified in wideband applications, where the spectrum being analyzed is expected to contain many different components of various amplitudes.

In between the extremes are moderate windows, such as Hann and Hamming. They are commonly used in narrowband applications, such as the spectrum of a telephone channel.

In summary, spectral analysis involves a trade-off between resolving comparable strength components with similar frequencies (high resolution / sensitivity) and resolving disparate strength components with dissimilar frequencies (high dynamic range). That trade-off occurs when the window function is chosen.

<!--

--->