Skip to content
Advertisement

What does np.fft.fftfreq actually do?

I have a monthly time series and I am taking the discrete fourier transform of it. However I am confused as to how numpy converts the time domain into frequency domain?

I am using np.fft.fftfreq and my time array is is 708 indices long and each measurement of the data is computed every month.

This is the output frequency using the numpy fftfreq:

JavaScript

But when I try to look at the sample rate and nyquist frequency, I cannot recreate the numpys frequency output. What is np.fft.fftfreq really doing to convert the time domain to the frequency domain?

I tried this:

JavaScript

Advertisement

Answer

Exactly what fftfreq is doing can be found here

And more information on the relationship between the input signal and the Fourier transform can be found here

The Nyquist frequency is only the minimum sampling frequency required to get complete information on a signal, and is not necessarily going to limit the FFT results.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement