# tensorplay.signal.windows.nuttall Source: https://www.tensorplay.cn/docs/generated/tensorplay.signal.windows.nuttall.html ```python tensorplay.signal.windows.nuttall(M: int, *, sym: bool = True, dtype: dtype | None = None, layout: Layout = tensorplay.strided, device: device | None = None, requires_grad: bool = False) → Tensor ``` Computes the minimum 4-term Blackman-Harris window described by Nuttall. The window is a general cosine sum with the Nuttall coefficients $a_0 = 0.3635819$, $a_1 = 0.4891775$, $a_2 = 0.1365995$, $a_3 = 0.0106411$: $$w_n = a_0 - a_1 \cos{(z_n)} + a_2 \cos{(2z_n)} - a_3 \cos{(3z_n)}$$ where $z_n = \frac{2 \pi n}{M - 1}$ for a symmetric window and $z_n = \frac{2 \pi n}{M}$ for a periodic one. The window is scaled so that its largest value is 1. The value 1 itself does not occur when M is even and sym is True. Parameters: M ([int](https://docs.python.org/3/builtins/functions.html#int)) – number of points of the returned window. Keyword Arguments: - sym ([bool](https://docs.python.org/3/builtins/functions.html#bool), optional) – if False, returns a periodic window, which is the usual choice for spectral analysis. If True, returns a symmetric window, which is the usual choice for filter design. Default: True. - dtype ([tensorplay.dtype](/docs/generated/tensorplay.DType.html#tensorplay.DType), optional) – the desired data type of the returned tensor. Default: if None, uses the global default (see [tensorplay.set_default_dtype()](/docs/generated/tensorplay.set_default_dtype.html#tensorplay.set_default_dtype)). - layout ([tensorplay.Layout](/docs/generated/tensorplay.Layout.html#tensorplay.Layout), optional) – the desired layout of the returned tensor. Default: tensorplay.strided. - device ([tensorplay.device](/docs/generated/tensorplay.Device.html#tensorplay.Device), optional) – the desired device of the returned tensor. Default: if None, uses the current default tensor device (see [tensorplay.set_default_device()](/docs/generated/tensorplay.set_default_device.html#tensorplay.set_default_device)). - requires_grad ([bool](https://docs.python.org/3/builtins/functions.html#bool), optional) – whether autograd should record operations on the returned tensor. Default: False. References: ``` - 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 ``` Examples: ``` >>> # Symmetric Nuttall window. >>> tensorplay.signal.windows.nuttall(5) tensor([0.0004, 0.227, 1., 0.227, 0.0004]) >>> # Periodic Nuttall window. >>> tensorplay.signal.windows.nuttall(5, sym=False) tensor([0.0004, 0.1105, 0.7983, 0.7983, 0.1105]) ```