fftfreq¶
- fftfreq(n: int, /, *, d: float = 1.0, device: device | None = None) array ¶
Computes the discrete Fourier transform sample frequencies.
For a Fourier transform of length
n
and length unit ofd
, the frequencies are described as:f = [0, 1, ..., n/2-1, -n/2, ..., -1] / (d*n) # if n is even f = [0, 1, ..., (n-1)/2, -(n-1)/2, ..., -1] / (d*n) # if n is odd
- Parameters:
n (int) – window length.
d (float) – sample spacing between individual samples of the Fourier transform input. Default:
1.0
.device (Optional[device]) – device on which to place the created array. Default:
None
.
- Returns:
out (array) – an array of shape
(n,)
containing the sample frequencies. The returned array must have the default real-valued floating-point data type.
Notes
New in version 2022.12.
Changed in version 2023.12: Required the output array have the default real-valued floating-point data type.