torch.signal.windows.nuttall¶
- torch.signal.windows.nuttall(M, *, sym=True, dtype=None, layout=torch.strided, device=None, requires_grad=False)[source][source]¶
根据 Nuttall 计算最小 4 项 Blackman-Harris 窗。
其中 。
窗函数被归一化到 1(最大值为 1)。但是,如果
M
是偶数且sym
为 True,则 1 不会出现。- 参数
M (int) – 窗函数的长度。换句话说,返回的窗函数的点数。
- 关键字参数
sym (bool, 可选) – 如果为 False,返回适用于频谱分析的周期性窗函数。如果为 True,返回适用于滤波器设计的对称窗函数。默认值:True。
dtype (
torch.dtype
, 可选) – 返回张量的期望数据类型。默认值:如果为None
,则使用全局默认值(参见torch.set_default_dtype()
)。layout (
torch.layout
, 可选) – 返回张量的期望布局。默认值:torch.strided
。device (
torch.device
, 可选) – 返回张量的期望设备。默认值:如果为None
,则使用默认张量类型的当前设备(参见torch.set_default_device()
)。device
对于 CPU 张量类型将是 CPU,对于 CUDA 张量类型将是当前 CUDA 设备。requires_grad (bool, 可选) – 如果 autograd 应该记录返回张量上的操作。默认值:
False
。
- 返回类型
参考
- A. Nuttall, "Some windows with very good sidelobe behavior," IEEE Transactions on Acoustics, Speech, and Signal Processing, vol. 29, no. 1, pp. 84-91, Feb 1981. https://doi.org/10.1109/TASSP.1981.1163506 - Heinzel G. et al., "Spectrum and spectral density estimation by the Discrete Fourier transform (DFT), including a comprehensive list of window functions and some new flat-top windows", February 15, 2002 https://holometer.fnal.gov/GH_FFT.pdf
示例
>>> # Generates a symmetric Nutall window. >>> torch.signal.windows.general_hamming(5, sym=True) tensor([3.6280e-04, 2.2698e-01, 1.0000e+00, 2.2698e-01, 3.6280e-04]) >>> # Generates a periodic Nuttall window. >>> torch.signal.windows.general_hamming(5, sym=False) tensor([3.6280e-04, 1.1052e-01, 7.9826e-01, 7.9826e-01, 1.1052e-01])