Window function
In signal processing and statistics, a window function is a mathematical function that is zero-valued outside of some chosen interval. Typically, window functions are symmetric around the middle of the interval, approach a maximum in the middle, and taper away from the middle. Mathematically, when another function or waveform/data-sequence is "multiplied" by a window function, the product is also zero-valued outside the interval: all that is left is the part where they overlap, the "view through the window". Equivalently, and in actual practice, the segment of data within the window is first isolated, and then only that data is multiplied by the window function values. Thus, tapering, not segmentation, is the main purpose of window functions.
The reasons for examining segments of a longer function include detection of transient events and time-averaging of frequency spectra. The duration of the segments is determined in each application by requirements like time and frequency resolution. But that method also changes the frequency content of the signal by an effect called spectral leakage. Window functions allow us to distribute the leakage spectrally in different ways, according to the needs of the particular application. There are many choices detailed in this article, but many of the differences are so subtle as to be insignificant in practice.
In typical applications, the window functions used are non-negative, smooth, "bell-shaped" curves. Rectangle, triangle, and other functions can also be used. A more general definition of window functions does not require them to be identically zero outside an interval, as long as the product of the window multiplied by its argument is square integrable, and, more specifically, that the function goes sufficiently rapidly toward zero.
Applications
Window functions are used in spectral analysis/modification/resynthesis, the design of finite impulse response filters, merging multiscale and multidimensional datasets, as well as beamforming and antenna design.File:Spectral_leakage_caused_by_%22windowing%22.svg|thumb|400px|Figure 2: Windowing a sinusoid causes spectral leakage. The same amount of leakage occurs whether there are an integer or non-integer number of cycles within the window. When the sinusoid is sampled and windowed, its discrete-time Fourier transform also exhibits the same leakage pattern. But when the DTFT is only sparsely sampled, at a certain interval, it is possible to: avoid the leakage, or create the illusion of no leakage. For the case of the blue DTFT, those samples are the outputs of the discrete Fourier transform. The red DTFT has the same interval of zero-crossings, but the DFT samples fall in-between them, and the leakage is revealed.
Spectral analysis
The Fourier transform of the function is zero, except at frequency ±ω. 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 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 affects the spectral estimate computed by this method.
Filter design
Windows are sometimes used in the design of digital filters, in particular to convert an "ideal" impulse response of infinite duration, such as a sinc function, to a finite impulse response filter design. That is called the window method.Statistics and curve fitting
Window functions are sometimes used in the field of statistical analysis to restrict the set of data being analyzed to a range near a given point, with a weighting factor that diminishes the effect of points farther away from the portion of the curve being fit. In the field of Bayesian analysis and curve fitting, this is often referred to as the kernel.Rectangular window applications
Analysis of transients
When analyzing a transient signal in modal analysis, such as an impulse, a shock response, a sine burst, a chirp burst, or noise burst, where the energy vs time distribution is extremely uneven, the rectangular window may be most appropriate. For instance, when most of the energy is located at the beginning of the recording, a non-rectangular window attenuates most of the energy, degrading the signal-to-noise ratio.Harmonic analysis
One might wish to measure the harmonic content of a musical note from a particular instrument or the harmonic distortion of an amplifier at a given frequency. Referring again to Figure 2, we can observe that there is no leakage at a discrete set of harmonically-related frequencies sampled by the discrete Fourier transform. This property is unique to the rectangular window, and it must be appropriately configured for the signal frequency, as described above.Overlapping windows
When the length of a data set to be transformed is larger than necessary to provide the desired frequency resolution, a common practice is to subdivide it into smaller sets and window them individually. To mitigate the "loss" at the edges of the window, the individual sets may overlap in time. See Welch method of power spectral analysis and the modified discrete cosine transform.Two-dimensional windows
Two-dimensional windows are commonly used in image processing to reduce unwanted high-frequencies in the image Fourier transform. They can be constructed from one-dimensional windows in either of two forms. The separable form, is trivial to compute. The radial form,, which involves the radius, is isotropic, independent on the orientation of the coordinate axes. Only the [|Gaussian] function is both separable and isotropic. The separable forms of all other window functions have corners that depend on the choice of the coordinate axes. The isotropy/anisotropy of a two-dimensional window function is shared by its two-dimensional Fourier transform. The difference between the separable and radial forms is akin to the result of diffraction from rectangular vs. circular apertures, which can be visualized in terms of the product of two sinc functions vs. an Airy function, respectively.Examples of window functions
Conventions:- is a zero-phase function, continuous for where is a positive integer.
- The sequence is symmetric, of length
- is DFT-symmetric, of length
- The parameter B displayed on each spectral plot is the function's noise equivalent bandwidth metric, in units of DFT bins.
- *See and Normalized frequency for understanding the use of "bins" for the x-axis in these plots.
Rectangular window
The rectangular window is the simplest window, equivalent to replacing all but N consecutive values of a data sequence by zeros, making the waveform suddenly turn on and off:Other windows are designed to moderate these sudden changes, to reduce scalloping loss and improve dynamic range.
The rectangular window is the 1st-order B-spline window as well as the 0th-power [|power-of-sine window].
The rectangular window provides the minimum mean square error estimate of the Discrete-time Fourier transform, at the cost of other issues discussed.
''B''-spline windows
B-spline windows can be obtained as k-fold convolutions of the rectangular window. They include the rectangular window itself, the and the . Alternative definitions sample the appropriate normalized B-spline basis functions instead of convolving discrete-time windows. A kth-order B-spline basis function is a piece-wise polynomial function of degree k − 1 that is obtained by k-fold self-convolution of the rectangular function.Triangular window
Triangular windows are given bywhere L can be N, N + 1, or N + 2. The first one is also known as Bartlett window or Fejér window. All three definitions converge at large N.
The triangular window is the 2nd-order B-spline window. The L = N form can be seen as the convolution of two -width rectangular windows. The Fourier transform of the result is the squared values of the transform of the half-width rectangular window.
Parzen window
Defining, the Parzen window, also known as the de la Vallée Poussin window, is the 4th-order B-spline window given byOther polynomial windows
Welch window
The Welch window consists of a single parabolic section:Alternatively, it can be written as two factors, as in a beta distribution:
The defining quadratic polynomial reaches a value of zero at the samples just outside the span of the window.
The Welch window is fairly close to the sine window, and just as the [|power-of-sine windows] are a useful parameterized family, the power-of-Welch window family is similarly useful. Powers of the Welch or parabolic window are also symmetric beta distributions, and are purely algebraic functions, as opposed to most windows that are transcendental functions. If different exponents are used on the two factors in the Welch polynomial, the result is a general beta distribution, which is useful for making [|asymmetric window functions].
Raised-cosine windows
Windows in the form of a cosine function offset by a constant, such as the popular Hamming and Hann windows, are sometimes called raised-cosine windows. The Hann window is particularly like the raised cosine distribution, which goes smoothly to zero at its ends.The raised-cosine windows have the form:
or alternatively as their zero-phase versions: