Main Content

本页翻译不是最新的。点击此处可查看最新英文版本。

hamming

汉明窗

说明

示例

w = hamming(L) 返回一个长度为 L 个点的对称汉明窗。

示例

w = hamming(L,sflag) 使用 sflag 所指定的窗采样返回汉明窗。

示例

全部折叠

创建一个长度为 64 个点的汉明窗。使用 wvtool 显示结果。

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, xlabel Samples, ylabel Amplitude contains an object of type line. Axes object 2 with title Frequency domain, xlabel Normalized Frequency (\times\pi rad/sample), ylabel Magnitude (dB) contains an object of type line.

设计两个汉明窗:

  • 第一个窗的 N = 64,它是对称窗。

  • 第二个窗的 N = 63,它是周期窗。

显示两个窗。

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, xlabel Samples, ylabel Amplitude contains 2 objects of type line. Axes object 2 with title Frequency domain, xlabel Normalized Frequency (\times\pi rad/sample), ylabel Magnitude (dB) contains 2 objects of type line. These objects represent Symmetric, Periodic.

输入参数

全部折叠

窗长度,指定为正整数。

数据类型: single | double

窗采样方法,指定为:

  • 'symmetric' - 在使用窗进行滤波器设计时使用此选项。

  • 'periodic' - 此选项对于频谱分析很有用,因为它使加窗信号可具有离散傅里叶变换中固有的完美周期延拓。当指定 'periodic' 时,该函数计算长度为 L + 1 的窗,并返回前 L 个点。

输出参数

全部折叠

汉明窗,以列向量形式返回。

算法

以下方程可生成汉明窗的系数:

w(n)=0.540.46cos(2πnN),0nN.

窗长度 L = N + 1。

参考

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

扩展功能

C/C++ 代码生成
使用 MATLAB® Coder™ 生成 C 代码和 C++ 代码。

版本历史记录

在 R2006a 之前推出

另请参阅

App

函数