scipy.signal.windows.

nuttall#

scipy.signal.windows.nuttall(M, sym=True)[源代码]#

根据 Nuttall 返回最小的 4 项 Blackman-Harris 窗。

这种变体被 Heinzel 称为 “Nuttall4c”。 [2]

参数
Mint

输出窗口中的点数。 如果为零,则返回一个空数组。 当为负数时,会抛出异常。

symbool,可选

当为 True (默认) 时,生成用于滤波器设计的对称窗口。 当为 False 时,生成用于频谱分析的周期性窗口。

返回
wndarray

窗口,最大值归一化为 1(尽管如果 M 为偶数且 sym 为 True,则不会出现值 1)。

参考文献

[1]

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. DOI:10.1109/TASSP.1981.1163506.

[2]

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

示例

绘制窗口及其频率响应

>>> import numpy as np
>>> from scipy import signal
>>> from scipy.fft import fft, fftshift
>>> import matplotlib.pyplot as plt
>>> window = signal.windows.nuttall(51)
>>> plt.plot(window)
>>> plt.title("Nuttall window")
>>> plt.ylabel("Amplitude")
>>> plt.xlabel("Sample")
>>> plt.figure()
>>> A = fft(window, 2048) / (len(window)/2.0)
>>> freq = np.linspace(-0.5, 0.5, len(A))
>>> response = 20 * np.log10(np.abs(fftshift(A / abs(A).max())))
>>> plt.plot(freq, response)
>>> plt.axis([-0.5, 0.5, -120, 0])
>>> plt.title("Frequency response of the Nuttall window")
>>> plt.ylabel("Normalized magnitude [dB]")
>>> plt.xlabel("Normalized frequency [cycles per sample]")
../../_images/scipy-signal-windows-nuttall-1_00.png
../../_images/scipy-signal-windows-nuttall-1_01.png