torch.signal.windows.nuttall#
- torch.signal.windows.nuttall(M, *, sym=True, dtype=None, layout=torch.strided, device=None, requires_grad=False)[source]#
计算根据Nuttall的最小4项Blackman-Harris窗。
其中 .
窗被归一化为1(最大值为1)。但是,当
M
是偶数且sym
为 True 时,1 不会显示。- 参数
M (int) – 窗的长度。换句话说,是返回的窗的点数。
- 关键字参数
sym (bool, optional) – 如果为 False,则返回一个适用于频谱分析的周期性窗。如果为 True,则返回一个适用于滤波器设计的对称窗。默认值:True。
dtype (
torch.dtype
, optional) – 返回张量的期望数据类型。默认值:如果None
,则使用全局默认值(请参阅torch.set_default_dtype()
)。layout (
torch.layout
, optional) – 返回张量的期望布局。默认值:torch.strided
。device (
torch.device
, optional) – 返回张量的期望设备。默认值:如果None
,则使用当前设备作为默认张量类型(请参阅torch.set_default_device()
)。对于 CPU 张量类型,device
为 CPU;对于 CUDA 张量类型,device
为当前 CUDA 设备。requires_grad (bool, optional) – 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])