Content deleted Content added
→Examples of window functions: add a WikiLink |
m →Ultraspherical window: HTTP to HTTPS for SourceForge |
||
(33 intermediate revisions by 21 users not shown) | |||
Line 3:
[[File:Hanning.svg|thumb|A popular window function, the [[Hann function|Hann window]]. Most popular window functions are similar bell-shaped curves.]]
In [[signal processing]] and [[statistics]], a '''window function''' (also known as an '''apodization function''' or '''tapering function'''<ref name=Weisstein/>) is a [[function (mathematics)|mathematical function]] that is zero-valued outside of some chosen [[interval (mathematics)|interval]]. Typically,
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.
Line 10:
== Applications ==
Window functions are used in spectral [[frequency spectrum#spectral analysis|analysis]]/modification/[[Overlap–add method#resynthesis|resynthesis]],<ref name=OLA/> the design of [[finite impulse response]] filters, merging multiscale and multidimensional datasets,<ref>{{Cite journal |last1=Ajala |first1=R. |last2=Persaud |first2=P. |title=Ground-Motion Evaluation of Hybrid Seismic Velocity Models |journal=The Seismic Record|date=2022 |volume=2 |issue=3 |pages=186–196 |doi=10.1785/0320220022 |s2cid=251504921 |doi-access=free |bibcode=2022SeisR...2..186A }}</ref><ref>{{Cite journal |last1=Ajala |first1=R. |last2=Persaud |first2=P. |title=Effect of Merging Multiscale Models on Seismic Wavefield Predictions Near the Southern San Andreas Fault |url=https://agupubs.onlinelibrary.wiley.com/doi/10.1029/2021JB021915 |journal=Journal of Geophysical Research: Solid Earth |date=2021 |language=en |volume=126 |issue=10 |doi=10.1029/2021JB021915 |bibcode=2021JGRB..12621915A |s2cid=239654900 |issn=2169-9313|url-access=subscription }}</ref> as well as [[beamforming]] and [[Antenna (radio)|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 (blue) or non-integer (red) number of cycles within the window (rows 1 and 2). When the sinusoid is sampled and windowed, its [[discrete-time Fourier transform]] (DTFT) 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 DTFT, those samples are the outputs of the [[discrete Fourier transform]] (DFT). 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 ===
{{Main|Spectral leakage}}
Line 23 ⟶ 22:
=== Filter design ===
{{Main|Filter design}}
Line 29 ⟶ 27:
=== Statistics and curve fitting ===
{{Main|kernel (statistics)}}
Line 35 ⟶ 32:
=== Rectangular window applications ===
==== Analysis of transients ====
Line 41 ⟶ 37:
==== 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]] (DFT). (The spectral nulls are actually zero-crossings, which cannot be shown on a logarithmic scale such as this.) This property is unique to the rectangular window, and it must be appropriately configured for the signal frequency, as described above.
Line 56 ⟶ 51:
*<math>w_0(x)</math> is a zero-phase function (symmetrical about <math>x=0</math>),<ref name=Zphase/> continuous for <math>x \in [-N/2, N/2],</math> where <math>N</math> is a positive integer (even or odd).<ref name=Rorabaugh/>
*The sequence
*<math>\{w[n],\quad 0\le n \le N-1\}</math>
|Some authors limit their attention to this important subset and to even values of N.<ref name=Harris/><ref name=Heinzel2002/> But the window coefficient formulas are still the ones presented here.}}
*The parameter '''B''' displayed on each spectral plot is the function's [[
**See {{Slink|spectral leakage|Discrete-time signals|Some window metrics}} and [[
The sparse sampling of a [[discrete-time Fourier transform]] (DTFT) such as the DFTs in Fig 2 only reveals the leakage into the DFT bins from a sinusoid whose frequency is also an integer DFT bin. The unseen sidelobes reveal the leakage to expect from sinusoids at other frequencies.{{efn-la
Line 77 ⟶ 72:
Other windows are designed to moderate these sudden changes, to reduce scalloping loss and improve dynamic range (described in {{slink||Spectral analysis}}).
The rectangular window is the
The rectangular window provides the minimum mean square error estimate of the [[Discrete-time Fourier transform]], at the cost of other issues discussed.
Line 85 ⟶ 80:
=== ''B''-spline windows ===
''B''-spline windows can be obtained as ''k''-fold convolutions of the rectangular window. They include the rectangular window itself (''k'' = 1), the {{slink|#Triangular window}} (''k'' = 2) and the {{slink|#Parzen window}} (''k'' = 4).<ref name=Toraichi89/> Alternative definitions sample the appropriate normalized [[B-spline|''B''-spline]] [[basis function]]s instead of convolving discrete-time windows. A ''k''
{{clear}}
Line 91 ⟶ 86:
[[File:Window function and its Fourier transform – Triangular (n = 0...N).svg|thumb|480px|right|Triangular window (with ''L'' = ''N'' + 1)]]
Triangular windows are given by
:<math>w[n] = 1 - \left|\frac{n - \frac{N}{2}}{\frac{L}{2}}\right|,\quad 0\le n \le N,</math>
where ''L'' can be ''N'',<ref name=Bartlett/> ''N'' + 1,<ref name=Harris/><ref name=Tukey/><ref name=MWtriang/> or ''N'' + 2.<ref name=Welch1967/> The first one is also known as '''[[M. S. Bartlett|Bartlett]] window''' or '''[[Lipót Fejér|Fejér]] window'''. All three definitions converge at large ''N''.
The triangular window is the
{{clear}}
Line 105 ⟶ 99:
{{Distinguish|Kernel density estimation}}
Defining
:<math>
Line 122 ⟶ 116:
=== Other polynomial windows ===
==== Welch window ====
Line 127 ⟶ 122:
:<math>w[n]=1 - \left(\frac{n-\frac{N}{2}}{\frac{N}{2}}\right)^2,\quad 0\le n \le N.</math><ref name=Welch1967/>
Alternatively, it can be written as two factors, as in a [[beta distribution]]:
:<math>w[n]= \left(1 + \frac{n-\frac{N}{2}}{\frac{N}{2}}\right) \left(1 - \frac{n-\frac{N}{2}}{\frac{N}{2}}\right),\quad 0\le n \le N.</math>
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|sine window]], and just as the [[#Power-of-sine/cosine windows|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 [[Pearson type II distribution]]s and symmetric [[beta distribution]]s, and are purely algebraic functions (if the powers are rational), 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|asymmetric window functions]].
{{clear}}
===
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:
:<math>w[n] = a_0 - (1-a_0) \cdot \cos\left( \tfrac{2 \pi n}{N} \right),\quad 0\le n \le N,</math>
or alternatively as their zero-phase versions:
:<math>
\begin{align}
w_0(n)\ &= w\left[ n+\tfrac{N}{2}\right]\\
&= a_0 + (1-a_0)\cdot \cos \left ( \tfrac{2\pi n}{N} \right),\quad -\tfrac{N}{2} \le n \le \tfrac{N}{2}.
\end{align}
</math>
==== Hann window====
{{Main|Hann function}}
[[File:Window function and its Fourier transform – Hann (n = 0...N).svg|thumb|480px|right|Hann window]]
Setting <math>a_0 = 0.5</math> produces a '''Hann window''':
:<math>w[n] = 0.5\; \left[1 - \cos \left ( \frac{2 \pi n}{N} \right) \right] = \sin^2 \left ( \frac{\pi n}{N} \right),</math><ref name=MWhann/>
named after [[Julius von Hann]], and sometimes referred to as ''Hanning'', which derived from the verb "to Hann".{{Citation needed|date=June 2025}} It is also known as the '''raised cosine''', because of its similarity to a [[raised-cosine distribution]].
This function is a member of both the [[#Cosine-sum windows|cosine-sum]] and [[#Power-of-sine/cosine_windows|power-of-sine]] families. Unlike the [[#Hann and Hamming windows|Hamming window]], the end points of the Hann window just touch zero. The resulting [[Spectral leakage|side-lobes]] roll off at about 18 dB per octave.<ref name=JOShann/>
==== Hamming window ====
[[File:Window function and frequency response - Hamming (alpha = 0.53836, n = 0...N).svg|thumb|480px|right|Hamming window, ''a''<sub>0</sub> = 0.53836 and ''a''<sub>1</sub> = 0.46164. The original Hamming window would have ''a''<sub>0</sub> = 0.54 and ''a''<sub>1</sub> = 0.46.]]
Setting <math>a_0</math> to approximately 0.54, or more precisely 25/46, produces the '''Hamming window''', proposed by [[Richard W. Hamming]]. This choice places a zero crossing at frequency 5{{pi}}/(''N'' − 1), which cancels the first sidelobe of the Hann window, giving it a height of about one-fifth that of the Hann window.<ref name=Harris/><ref name=Enochson/><ref name=JOSHamming/>
The Hamming window is often called the '''Hamming blip''' when used for [[pulse shaping]].<ref name=sunar/><ref name=sunar2/><ref name=SRD/>
Approximation of the coefficients to two decimal places substantially lowers the level of sidelobes,<ref name=Harris/> to a nearly equiripple condition.<ref name=JOSHamming/> In the equiripple sense, the optimal values for the coefficients are ''a''<sub>0</sub> = 0.53836 and ''a''<sub>1</sub> = 0.46164.<ref name=JOSHamming/><ref name=Nuttall/>
=== Cosine-sum windows ===
This family, which generalizes the [[#Raised-cosine windows|raised-cosine windows]], is also known as
{{Equation box 1
Line 176 ⟶ 175:
|background colour=#F5FFFA}}
In most cases, including the examples below, all coefficients ''a''<sub>''k''</sub> ≥ 0.
==== Blackman window ====
[[File:Window function and its Fourier transform – Blackman (n = 0...N).svg|thumb|480px|right|Blackman window; {{math|1=''α'' = 0.16}}]]
Blackman windows are defined as
:<math>w[n] = a_0 - a_1 \cos \left ( \frac{2 \pi n}{N} \right) + a_2 \cos \left ( \frac{4 \pi n}{N} \right),</math>
:<math>a_0=\frac{1-\alpha}{2};\quad a_1=\frac{1}{2};\quad a_2=\frac{\alpha}{2}.</math>
Line 241 ⟶ 209:
[[File:Window function and frequency response - Blackman-Harris.svg|thumb|480px|right|Blackman–Harris window]]
A generalization of the Hamming family, produced by adding more shifted
:<math>w[n]=a_0 - a_1 \cos \left ( \frac{2 \pi n}{N} \right)+ a_2 \cos \left ( \frac{4 \pi n}{N} \right)- a_3 \cos \left ( \frac{6 \pi n}{N} \right)</math>
Line 272 ⟶ 240:
Rife–Vincent windows<ref name=Rife/> are customarily scaled for unity average value, instead of unity peak value. The coefficient values below, applied to {{EquationNote|Eq.1}}, reflect that custom.
Class I, Order 1 (''K'' = 1):
Class I, Order 2 (''K'' = 2):
Class I is defined by minimizing the high-order sidelobe amplitude. Coefficients for orders up to K=4 are tabulated.<ref name=Andria/>
Line 282 ⟶ 250:
Class III is a compromise for which order ''K'' = 2 resembles the {{slink|#Blackman window}}.<ref name=Andria/><ref name=Schoukens/>
{{clear}}
=== Sine window ===
[[File:Window function and frequency response - Cosine.svg|thumb|480px|right|Sine window]]
:<math>w[n] = \sin\left(\frac{\pi n}{N}\right) = \cos\left(\frac{\pi n}{N} - \frac{\pi}{2}\right),\quad 0\le n \le N.</math>
The corresponding <math>w_0(n)\,</math> function is a cosine without the {{pi}}/2 phase offset. So the ''sine window''<ref name=Bosi/> is sometimes also called ''cosine window''.<ref name=Harris/> As it represents half a cycle of a sinusoidal function, it is also known variably as ''half-sine window''<ref name=Kido/> or ''half-cosine window''.<ref name=Landisman/>
The [[autocorrelation]] of a sine window produces a function known as the Bohman window.<ref name=MWbohman/>
==== Power-of-sine/cosine windows ====
[[File:Power-of-sine windows.png|thumb|440px|Power-of-sine window functions (left) and their spectra in dB (right), for powers 0, 0.25, 0.5, 1, 2, 4]]
These window functions have the form:<ref name=PowCos/>
:<math>w[n] = \sin^\alpha\left(\frac{\pi n}{N}\right) = \cos^\alpha\left(\frac{\pi n}{N} - \frac{\pi}{2}\right),\quad 0\le n \le N.</math>
The [[#Rectangular window|rectangular window]] ({{math|1=''α'' = 0}}), the [[#Sine window|sine window]] ({{math|1=''α'' = 1}}), and the [[#Hann and Hamming windows|Hann window]] ({{math|1=''α'' = 2}}) are members of this family.
For even-integer values of {{mvar|α}} these functions can also be expressed in cosine-sum form:
: <math>w[n]=a_0 - a_1 \cos \left ( \frac{2 \pi n}{N} \right)+ a_2 \cos \left ( \frac{4 \pi n}{N} \right)- a_3 \cos \left ( \frac{6 \pi n}{N} \right)+ a_4 \cos \left ( \frac{8 \pi n}{N} \right)- ...</math>
: <math>\begin{array}{l|llll}
\hline
\alpha & a_0 & a_1 & a_2 & a_3 & a_4 \\
\hline
0 & 1 \\
2 & 0.5 & 0.5 \\
4 & 0.375 & 0.5 & 0.125 \\
6 & 0.3125 & 0.46875 & 0.1875 & 0.03125 \\
8 & 0.2734375 & 0.4375 & 0.21875 & 0.0625 & 7.8125\times10^{-3} \\
\hline
\end{array}</math>
{{clear}}
Line 295 ⟶ 297:
:<math>\sigma \le \;0.5\,</math>
The standard deviation of the Gaussian function is ''σ''
{{clear}}
Line 301 ⟶ 303:
==== Confined Gaussian window ====
The confined Gaussian window yields the smallest possible root mean square frequency width {{math|''σ''{{sub|''ω''}}}} for a given temporal width
{{clear}}
Line 308 ⟶ 310:
==== Approximate confined Gaussian window ====
Defining
:<math>w[n] = G(n) - \frac{G(-\tfrac{1}{2})[G(n + L) + G(n - L)]}{G(-\tfrac{1}{2} + L) + G(-\tfrac{1}{2} - L)}</math>
Line 316 ⟶ 318:
::<math>G(x) = \exp\left(- \left(\cfrac{x - \frac{N}{2}}{2 L \sigma_t}\right)^2\right)</math>
The standard deviation of the approximate window is [[asymptotically equal]] (i.e. large values of {{math|''N''}}) to
{{clear}}
Line 340 ⟶ 342:
w[N-n] = w[n],\quad & 0 \le n \le \frac{N}{2}
\end{array}\right\}
</math>
|1=This formula can be confirmed by simplifying the cosine function at [http://www.mathworks.com/help/signal/ref/tukeywin.html MATLAB tukeywin] and substituting ''r''=''α'' and ''x''=''n''/''N''.
}}{{efn-ua
Line 349 ⟶ 351:
==== Planck-taper window ====
[[File:Window function and frequency response - Planck-taper (epsilon = 0.
The so-called "Planck-taper" window is a [[bump function]] that has been widely used<ref name=Tu/> in the theory of [[partitions of unity]] in [[manifolds]]. It is [[Smooth function|smooth]] (a <math>C^\infty</math> function) everywhere, but is exactly zero outside of a compact region, exactly one over an interval within that region, and varies smoothly and monotonically between those limits. Its use as a window function in signal processing was first suggested in the context of [[gravitational-wave astronomy]], inspired by the [[Planck's law|Planck distribution]].<ref name=McKechan/> It is defined as a [[piecewise]] function''':'''
Line 368 ⟶ 370:
==== DPSS or Slepian window ====
The DPSS (discrete prolate spheroidal sequence) or [[Slepian function]], taper, or window [[Spectral concentration problem|maximizes the energy concentration in the main lobe]],<ref name=Slepian/> and is used in [[multitaper]] spectral analysis, which averages out noise in the spectrum and reduces information loss at the edges of the window.
The main lobe ends at a frequency bin given by the parameter ''α''.<ref name=KaiserDPSS/>
Line 386 ⟶ 388:
The Kaiser, or Kaiser–Bessel, window is a simple approximation of the [[#DPSS or Slepian window|DPSS window]] using [[Bessel function]]s, discovered by [[James Kaiser]].<ref name=Kaiser1966/><ref name=Kaiser1964/>
:<math>w[n]=\frac{I_0\left(\pi\alpha \sqrt{1-\left(\frac{2 n}{N}-1\right)^2}\right)}{I_0(\pi\alpha)},\quad 0\le n \le N</math>
|The Kaiser window is often parametrized by {{math|''β''}}, where {{math|1=''β'' = {{pi}}''α''}}.<ref name=Rabiner/><ref name=Crochiere/>
<ref name=Vaidyanathan/><ref name=JOSKaiser/><ref name=KaiserDPSS/><ref name=MWkaiser/><ref name=Oppenheim/>{{rp|p. 474}}
}}<ref name=Harris/>{{rp|p. 73}}
:<math>
w_0(n) = \frac{I_0\left(\pi\alpha \sqrt{1-\left(\frac{2 n}{N}\right)^2}\right)}{I_0(\pi\alpha)},\quad -N/2 \le n \le N/2</math>
where <math>I_0</math> is the 0{{Sup|th}}-order modified Bessel function of the first kind. Variable parameter <math>\alpha</math> determines the tradeoff between main lobe width and side lobe levels of the spectral leakage pattern. The main lobe width, in between the nulls, is given by
{{clear}}
Line 439 ⟶ 441:
\end{align}</math>
which is an inverse DFT of
Variations:
Line 447 ⟶ 449:
==== Ultraspherical window ====
[[File:Window function and frequency response - Ultraspherical (mu = -0.5).svg|thumb|480px|right|The Ultraspherical window's ''
The Ultraspherical window was introduced in 1984 by Roy Streit<ref name=Kabal/> and has application in antenna array design,<ref name=Streit/> non-recursive filter design,<ref name=Kabal/> and spectrum analysis.<ref name=Deczky/>
Line 461 ⟶ 463:
where <math>C^{\mu}_{N}</math> is the [[Ultraspherical polynomial]] of degree N, and <math>x_0</math> and <math>\mu</math> control the side-lobe patterns.<ref name=Deczky/>
Certain specific values of <math>\mu</math> yield other well-known windows: <math>\mu=0</math> and <math>\mu=1</math> give the Dolph–Chebyshev and [[Tapio Saramäki|Saramäki]] windows respectively.<ref name=Kabal/> See [
{{clear}}
Line 516 ⟶ 518:
The GAP window is a family of adjustable window functions that are based on a symmetrical polynomial expansion of order <math>K</math>. It is continuous with continuous derivative everywhere. With the appropriate set of expansion coefficients and expansion order, the GAP window can mimic all the known window functions, reproducing accurately their spectral properties.
:<math>w_0[n] = a_{0} + \sum_{k=1}^{K} a_{2k}\left(\frac{n}{\sigma}\right)^{2k}, \quad -\frac{N}{2} \le n \le \frac{N}{2},</math>
where <math>\sigma</math> is the standard deviation of the <math>\{n\}</math> sequence.
Line 533 ⟶ 535:
=== Asymmetric window functions ===
The <math>w_0(x)</math> form, according to the convention above, is symmetric around <math>x = 0</math>. However, there are window functions that are asymmetric, such as the [[
Any [[bounded function]] with [[compact support]], including asymmetric ones, can be readily used as a window function. Additionally, there are ways to transform symmetric windows into asymmetric windows by transforming the time coordinate, such as with the below formula
Line 629 ⟶ 631:
{{cite patent
|title=Wideband communication intercept and direction finding device using hyperchannelization
|invent1=Carlin, Joe
|invent2=Collins, Terry
|invent3=Hays, Peter
|invent4=Hemmerdinger, Barry E. Kellogg, Robert L. Kettig, Robert L. Lemmon, Bradley K. Murdock, Thomas E. Tamaru, Robert S. Ware, Stuart M.
|pubdate=1999-12-10
|fdate=1999-12-10
Line 639 ⟶ 641:
|status=patent
|number=6898235
}}
<ref name=Rorabaugh>
{{cite book
Line 701:
<ref name=Kido>
{{cite journal |last1=Kido |first1=Ken'iti |last2=Suzuki |first2=Hideo |last3=Ono |first3=Takahiko |last4=Fukushima |first4=Manabu |date=1998 |title=Deformation of impulse response estimates by time window in cross spectral technique |journal=Journal of the Acoustical Society of Japan
|doi-access=free
}}</ref>
Line 735:
| chapter =11
| isbn =978-1-139-50145-3
}}
</ref>
Line 792:
<ref name=Blackman1959>
{{cite book |url=https://smile.amazon.com/Measurement-Power-Spectra-Communications-Engineering/dp/B0006AW1C4 |title=The Measurement of Power Spectra from the Point of View of Communications Engineering |last1=Blackman |first1=R.B. |author1-link=R. B. Blackman |last2=Tukey |first2=J.W. |date=1959-01-01 |publisher=Dover Publications |isbn=978-0-486-60507-4 |page=99
}}</ref>
Line 818:
<ref name=Starosielec2014>
{{cite journal |last1=Starosielec |first1=S. |last2=Hägele |first2=D. |title=Discrete-time windows with minimal RMS bandwidth for given RMS temporal width |journal=Signal Processing |volume=102 |pages=240–246 |date=2014 |doi=10.1016/j.sigpro.2014.03.033
|bibcode=2014SigPr.102..240S }}</ref>
<ref name=Chakraborty>
Line 873:
<ref name=Streit>
{{cite journal |last=Streit |first=Roy |title=A two-parameter family of weights for nonrecursive digital filters and antennas |journal= IEEE Transactions
|url=https://zenodo.org/record/1280988 }}</ref>
Line 894:
<ref name=Deczky>
{{cite book |last=Deczky |first=Andrew |chapter=Unispherical Windows |year=2001 |volume=2 |pages=85–88 |doi=10.1109/iscas.2001.921012 |isbn=978-0-7803-6685-5 |title=ISCAS 2001. The 2001 IEEE International Symposium on Circuits and Systems (Cat. No. 01CH37196)
|s2cid=38275201 }}</ref>
Line 991:
<ref name=Berry>
{{cite journal |last1=Berry |first1=C.P.L. |last2=Gair |first2=J.R. |title=Observing the Galaxy's massive black hole with gravitational wave bursts |journal=[[Monthly Notices of the Royal Astronomical Society]] |date=12 December 2012 |volume=429 |issue=1 |arxiv=1210.2778 |pages=589–612 |doi=10.1093/mnras/sts360|doi-access=free |bibcode=2013MNRAS.429..589B
|s2cid=118944979 }}</ref>
|