rfftfreq¶
- paddle.fft. rfftfreq ( n, d=1.0, dtype=None, name=None ) [source]
-
Return the Discrete Fourier Transform sample frequencies.
The returned floating-point array “F” contains the center of the frequency unit, and the unit is the number of cycles of the sampling interval (the starting point is zero).
Given input length n and a sample spacing d:
f = [0, 1, ..., n/2-1, n/2] / (d*n) if n is even f = [0, 1, ..., (n-1)/2-1, (n-1)/2] / (d*n) if n is odd
the Nyquist frequency component is considered to be positive.
- Parameters
-
n (int) – Dimension inputed.
d (scalar, optional) – Sample spacing (inverse of the sampling rate). Defaults is 1.
dtype (str, optional) – The data type of returns. Defaults is the data type of returns of
paddle.get_default_dtype()
.name (str, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name.
- Returns
-
Tensor. A tensor of length
n//2 + 1
containing the sample frequencies.
Examples
>>> import paddle >>> scalar_temp = 0.3 >>> rfftfreq_xp = paddle.fft.rfftfreq(5, d=scalar_temp) >>> print(rfftfreq_xp) Tensor(shape=[3], dtype=float32, place=Place(cpu), stop_gradient=True, [0., 0.66666669, 1.33333337])