When I plot the fft result of an audio signal on the positive side of frequency axis I get the following figure, I understand the signal on the right side of the Nyquist point is just a mirror image of the original signal, the sharp noise is somewhere around 1700Hz: enter image description here

Now when I plot the fft of the same signal from negative frequency to positive, that noisy component is now sitting somewhere around 2300Hz and when I check the fft of the audio signal, the sharp noise is indeed at 2300Hz and not 1700Hz, the audio content also is no longer below 1KHz and it's now instead just below 4KHz. What exactly is going on here ? Why the top plot appears to be giving me the wrong information ? enter image description here

I have tried to find the reason online but I don't think I am googling the right words, hence can't find anything.

  • $\begingroup$ You need to append the first half to the second half to go between these. You’ve shifted the whole data set by Fs/2, which is not correct. $\endgroup$
    – Dan Szabo
    Commented Apr 21, 2021 at 22:51

2 Answers 2


Can you advise:

  1. What is the sample interval
  2. What did you use to calculate the spectrum.

Edit 2: The top one looks right, plotting from 0 Hz to 2*Nyquist. Not sure how you calculated the spectrum, but this may be the convention with that package.

If you prefer to present the spetrum from -ve Nyq to +ve Nyq you can't just plot the same results with new axes.

You will need to recalculate either with a function which uses that convention, or else do the DFT yourself, or else you could just move the results above nyquist and use these for the negative part.

Edit 3: Nothing wrong, It is just an axis labelling thing. The way your program has calculated the FFT, the answer is normaly interpreted as 0Hz to 2*Nyquist. Or if you prefer you could relabel it from left to right as: (0-> nyquist), then (-Nyquist > 0) If you want it to present as (-Nyq > Nyq) you need to rearrange the answer. ("Roll" the right half of the array across to the left.)

  • $\begingroup$ The sampling frequency is 8192Hz and there are 13061 samples, to get the frequency for 0 o f I did: f = (1:N/2)*fs/N and for -f to f: f = (-N/2+1:N/2)*fs/N $\endgroup$ Commented Apr 21, 2021 at 22:34
  • $\begingroup$ Thanks for confirming that the top one is correct, I believe I now know where I misunderstood things and assumed the bottom one is right. So X is the fft of signal x and I found the largest component(the noise) with [~,M]=max(X(1:3000)); M returns 2752 and that's sample number 2752, not 2752Hz. I converted 2752 to frequency using 2752 * 8192/13061 = 1726Hz which confirms indeed the top plot is the correct one(noise at 1762Hz). Any reason why the bottom plot confuses sample# 2752 with 2752Hz and mistakenly places the large noise over on top of that frequency instead of 1762 Hz ? $\endgroup$ Commented Apr 22, 2021 at 0:29

To be clear, the FFT provides the result of the individual frequencies as weighted complex exponential frequencies, meaning the coefficients of $e^{j\omega t}$ not to be confused with our typical first introduction of "frequency" as periods of $\cos(\omega t)$ or $\sin(\omega t)$.

Once put to practice the exponential form is MUCH more intuitive for DSP applications in general and the first introduction to see the relationship between the two is Euler's formula:

$$\cos(\omega t) = \frac{1}{2}e^{-j\omega t} + \frac{1}{2}e^{+j\omega t}$$

From this we see that the widely recognized sinusoidal form actually consists of two exponential frequencies, $e^{-j\omega t}$ and $e^{+j\omega t}$, consisting of a "negative frequency" and a "positive frequency".

To see this intuitively, know first that the otherwise possibly confusing form $e^{j\phi}$ represents a phasor on the complex plane (something that can be represented with a magnitude and phase) having a magnitude of one and a phase of $\phi$, basically equivalent to the trigonometric expression $1 \angle \phi$. Each exponential frequency can be viewed as a phasor of constant magnitude rotating at a constant rate (given by $\omega t$ on the complex plane in either the positive phase (counter-clockwise) or negative phase (clock-wise) direction. We then see with the cosine relationship above that a cosine wave is the sum of two such rotating complex phasors. You can graphically add two phasors by putting one on the end of the other such that the result stays on the real axis, and with time moving forward will map out a cosine in its real magnitude:


Next after a study of sampling theory (which is explained extensively in other posts on this site) we would better understand that the frequency in the upper half of the DFT spectrum is identical to the negative frequencies as explained above with the cosine, where the entire frequency spectrum starting from the left extends from DC (f=0) to half the sampling rate at half the DFT spectrum, and then from that point forward represents the frequencies from minus half the sampling rate back to one sample less than DC at the far right of the spectrum.

With this we see that the OP's spectrum properly represents either a sine or cosine or a combination of either at a particular phase offset (a point that would be further clarified by evaluating the phase of the DFT).

DFT Spectrum

In MATLAB/Octave and Python scipy the command fftshift is used to transform the DFT form in the plot above to the spectrum with the frequency axis extending to both negative and positive frequencies.

  • $\begingroup$ Very informative, thank you. $\endgroup$ Commented Apr 22, 2021 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.