Documentation

hann

Hann (Hanning) window

Description

example

w= hann(L)returns anL-point symmetric Hann window.

w= hann(L,sflag)returns a Hann window using the window sampling specified bysflag.

Examples

collapse all

Create a 64-point Hann window. Display the result usingwvtool.

L = 64; wvtool(hann(L))

Input Arguments

collapse all

Window length, specified as a positive integer.

Data Types:single|double

Window sampling, specified as one of the following:

  • 'symmetric'— Use this option when using windows for filter design.

  • 'periodic'— This option is useful for spectral analysis because it enables a windowed signal to have the perfect periodic extension implicit in the discrete Fourier transform. When'periodic'is specified,hanncomputes a window of lengthL+ 1 and returns the firstLpoints.

Output Arguments

collapse all

Hann window, returned as a column vector.

Algorithms

The following equation generates the coefficients of a Hann window:

w ( n ) = 0.5 ( 1 cos ( 2 π n N ) ) , 0 n N .

The window lengthL=N+ 1.

References

[1] Oppenheim, Alan V., Ronald W. Schafer, and John R. Buck.Discrete-Time Signal Processing. Upper Saddle River, NJ: Prentice Hall, 1999.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced before R2006a