location of second peaks in fft

5 views (last 30 days)
peter
peter on 28 Oct 2022
Edited: Paul on 28 Oct 2022
Hello,
I know that if you for example fourier transform a clear sinus signal with frequency ω you still get two peaks. I read that it comes from the fact that but in the example that is used here the two (or rather 4 peaks in the example) are not at and ω. They are only at ω and after fftshift is apllied. I wonder why initially one peak is somewhere else and why it is exactly there. So, sticking to the example, why are the second peaks at and although the frequencies of the function are and ?

Accepted Answer

Paul
Paul on 28 Oct 2022
Edited: Paul on 28 Oct 2022
Hi peter,
The elements of the output of fft as implemented in Matlab correspond to angles around the unit circle. For an N-point fft, these angles are (in rad)
theta = (0:(N-1))/N*2*pi, i.e., start at zero and go CCW around the unit circle.
These angles can be converted to Hz (cycles/sec) by: fHz = theta*Fs/2/pi, where Fs is the sampling frequency in Hz.
If N is even, then one angle will be exactly pi, which corresponds to frequency pi*Fs/2/pi = Fs/2, which is the Nyquist frequency.
So, in the exammple we get two frequencies at 15 and 20, and two others that are mirrored around Fs/2. Because Fs/2 = 25, we get Fs/2 + (Fs/2 - 15) = 35 and Fs/2 + (Fs/2 - 20) = 30.
However, the angles that correspond to those higher frequencies are greater than pi. For this discussion, any value of theta >= pi is equivlent to theta - 2*pi. So those frequencies can be equally viewed as (35*2*pi/Fs - 2*pi)*Fs/2/pi = 35 - Fs = 35 - 50 = -15, and similarly for the other.
fftshift rearranges the ouput of fft so that angles in theta cover the interval from -pi to pi, the details of which depend on whether N is even or odd. So after applying fftshift, the frequency vector has to be computed based on those angles, not the angles that corresponded to the original output of fft.

More Answers (0)

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by