I'm currently trying to learn how to calculate DFT using FFT with Python. However, I have been struggling to find how should I choose the frequency grid when plotting the final calculated DFT values out of the data samples that I have. Any helpful insights will be appreciated!
It really depends on your application and what you want to see and the actual FFT call you make. Typically if your time series is real valued, the DFT will be conjugate symmetric with respect to negative and positive frequencies and the magnitude information is redundant. Let assume your data consists of N samples and N is even and you used a complex DFT, also assume you use C style indexes, i.e. X is the first element in your array. X is going to correspond to the "DC" bin or a frequency of zero. X[N/2]will correspond to the Nyquist sample frequency. Most People with ignore X[N/2+ 1] to X[N-1] (or often X[N/2] to X[N]) The thing to remember is that each bin has a conjugate valued twin. X and X[N/2] are pairs of a sort but don't follow this rule. X is paired with X[N], X with X[N-1] , X with X[N-2], and so forth. One is the positive frequency and the other the corresponding negative frequency.
If you recall your sampling theory, the Discrete Frequency Spectra is periodic, so you can think of the values X[N/2] to X[N] as either the negative frequencies of the spectrum of the cycle centered at DC or the negative frequencies of the cycle centered at the twice the sample (+) frequency. I typically will reorder the upper frequencies so that they are displayed below so the DC bin is the center point of my plot and Matlab has a function called FFTSHIFT that does that, and it also works if N is odd.
If your time series is complex, there are different possibilities. If x is a Hilbert transpose, the negative frequencies are zero, so unless you want to verify that, it doesn't make much sense to display zeros.
If x is a signal such as an I and Q pair out of a demodulator, using a FFTSHIFT ordering is generally preferable because the frequency shifted carrier will be in the center.
The fact that the upper half of the output are actually the negative frequencies was something that confused me many moons ago.