Skip to content Skip to sidebar Skip to footer

Meaning Of The Function Numpy.fft.fftfreq

Some days ago I came across this answer about the usage of the FFT In the answer there's a piece of code like this: w = np.fft.fft(data) freqs = np.fft.fftfreq(len(w)) I read abou

Solution 1:

The returned float array f contains the frequency bin centers in cycles per unit of the sample spacing (with zero at the start). For instance, if the sample spacing is in seconds, then the frequency unit is cycles/second.

fftfreq gives the range of possible frequencies of Fourier Transform.

Solution 2:

np.fft.fftfreq try to map the frequency range (y) to a kind of "index" range (x) as the following figure. Note that blue line -> positive frequency, orange line -> negative frequency.

Post a Comment for "Meaning Of The Function Numpy.fft.fftfreq"