Main Content

hamming

Hamming window

Description

example

w= hamming(L)returns anL-point symmetric Hamming window.

example

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

Examples

collapse all

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

L = 64; wvtool(hamming(L))

Figure Window Visualization Tool contains 2 axes objects and other objects of type uimenu, uitoolbar, uipanel. Axes object 1 with title Time domain contains an object of type line. Axes object 2 with title Frequency domain contains an object of type line.

Design two Hamming windows:

  • The first window hasN= 64 and is symmetric.

  • The second window hasN= 63 and is periodic.

Display the two windows.

Hs = hamming(64,'symmetric'); Hp = hamming(63,'periodic'); wvt = wvtool(Hs,Hp); legend(wvt.CurrentAxes,'Symmetric','Periodic')

Figure Window Visualization Tool contains 2 axes objects and other objects of type uimenu, uitoolbar, uipanel. Axes object 1 with title Time domain contains 2 objects of type line. Axes object 2 with title Frequency domain contains 2 objects of type line. These objects represent Symmetric, Periodic.

Input Arguments

collapse all

Window length, specified as a positive integer.

Data Types:single|double

Window sampling method, specified as:

  • '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, the function computes a window of lengthL+ 1 and returns the firstLpoints.

Output Arguments

collapse all

Hamming window, returned as a column vector.

Algorithms

The following equation generates the coefficients of a Hamming window:

w ( n ) = 0.54 0.46 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™.

版本嗨story

Introduced before R2006a

See Also

Apps

Functions