mindspore.ops.bartlett_window

View Source On Gitee
mindspore.ops.bartlett_window(window_length, periodic=True, *, dtype=None)[source]

Bartlett window function.

A triangular-shaped weighting function used for smoothing or frequency analysis of signals in digital signal processing.

w[n]=1|2nN11|={2nN1if 0nN1222nN1if N12<n<N,

where N is the full window size, and n is natural number less than N :[0, 1, …, N-1].

Parameters
  • window_length (Tensor) – The size of window.

  • periodic (bool, optional) – If True , return a periodic window. If False, return a symmetric window. Default True .

Keyword Arguments

dtype (mindspore.dtype, optional) – The data type specified. Default None .

Returns

A 1-D tensor.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> window_length = mindspore.tensor(5)
>>> output = mindspore.ops.bartlett_window(window_length)
>>> print(output)
[0.  0.4 0.8 0.8 0.4]
>>> output = mindspore.ops.bartlett_window(window_length, periodic=False)
>>> print(output)
[0.  0.5 1.  0.5 0. ]