represents a Hann window function of x.


uses the parameter α.


  • HannWindow is a window function typically used for finite impulse response (FIR) filter design and spectral analysis.
  • Window functions are used in applications where data is processed in short segments and have a smoothing effect by gradually tapering data values to zero at the ends of each segment.
  • HannWindow[x,α] is equal to  alpha-alpha cos(2 pi x)+cos(2 pi x) -1/2<=x<=1/2; 0 TemplateBox[{x}, Abs]>1/2; .
  • HannWindow[x] is equivalent to HannWindow[x,1/2].
  • HannWindow automatically threads over lists.


open allclose all

Basic Examples  (3)

Shape of a 1D Hann window:

Shape of a 2D Hann window:

Extract the continuous function representing the Hann window:

Parameterized Hann window:

Scope  (6)

Evaluate numerically:

Shape of a 1D Hann window using a specified parameter:

Variation of the shape as a function of the parameter α:

Translated and dilated Hann window:

2D Hann window with a circular support:

Discrete Hann window of length 15:

Discrete 15×10 2D Hann window:

Applications  (4)

Create a lowpass FIR filter with cutoff frequency of and length 21:

Taper the filter using a Hann window to improve stopband attenuation:


Log-magnitude plot of the power spectra of the two filters:

Filter a white noise signal using the Hann window method:

Use a window specification to calculate sample PowerSpectralDensity:

Calculate the spectrum:

Compare to spectral density calculated without a windowing function:

The plot shows that window smooths the spectral density:

Compare to the theoretical spectral density of the process:

Use a window specification for time series estimation:

Specify window for spectral estimator:

Properties & Relations  (6)

HannWindow[x,1] is equivalent to a Dirichlet window:

HannWindow[x,25/46] is equivalent to a Hamming window:

The area under the Hann window:

Normalize to create a window with unit area:

Fourier transform of the Hann window:

Power spectrum of the Hann window:

Discrete-time Fourier transform of the discrete Hann window of length 11:

Magnitude at ω=0:

Magnitude spectrum:

Power spectra of the Hann and rectangular windows:

Possible Issues  (1)

2D sampling of Hann window will use a different parameter for each row of samples when passed as a symbol to Array:

Use a pure function instead:

Wolfram Research (2012), HannWindow, Wolfram Language function, https://reference.wolfram.com/language/ref/HannWindow.html.


Wolfram Research (2012), HannWindow, Wolfram Language function, https://reference.wolfram.com/language/ref/HannWindow.html.


Wolfram Language. 2012. "HannWindow." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/HannWindow.html.


Wolfram Language. (2012). HannWindow. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/HannWindow.html


@misc{reference.wolfram_2024_hannwindow, author="Wolfram Research", title="{HannWindow}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/HannWindow.html}", note=[Accessed: 24-July-2024 ]}


@online{reference.wolfram_2024_hannwindow, organization={Wolfram Research}, title={HannWindow}, year={2012}, url={https://reference.wolfram.com/language/ref/HannWindow.html}, note=[Accessed: 24-July-2024 ]}