# position of spike in the spectrum of a sin wave

I have a sin wave of 16Hz, sampled at 2048 samples persecond. I performed the FFT of the sequence and did a spectrum plot. My plot gave me two spikes at both ends of the graph. But i was told the spike is meant to be at 16. how exactly am i supposed to do the plotting in order to get this exact spike?

• You are taking 128 samples of each cycle of your sinusoid and so your FFT will have two spikes in it. If you want a spike in the 16th bin, you need to do a FFT of length 2048. If you do a FFT of length 128, you will see a spike at both ends (bins #1 and #127). This assumes that the bins are numbered from 0 to 127; MATLAB uses a different convention. – Dilip Sarwate Dec 21 '13 at 17:09
• I am having the same challenge, and the FFT i took was that of length 2048, but the spike was still at both ends. So what should be done? – Nazario_Jnr Dec 22 '13 at 11:47

A sinusoid is the sum of two complex exponentials ("negative" and "positive" frequency) so that their imaginary parts cancel out each other:

$$cos(f \cdot t) = \frac{1}{2} \left( exp(f \cdot t \cdot i) + exp(-f \cdot t \cdot i) \right)$$

The Fourier Transform decomposes your input into a weighted sum of complex exponentials. Therefore, you get to see two pulses in the spectrum. One at -f and another at +f, basically. Typically, the "negative half" of the spectrum is located after the positive half because in discrete signals there is no difference between -f Hz and fs-f Hz where fs is the sampling frequency. So, your FFT result's ordering is 0 Hz to almost fs Hz where you can think of the second half as the negative portion of the spectrum.

Since real-valued signals have an imaginary part of zero, you'll notice that the Fourier Transform of real-valued signals always exhibits a symmetry between negative and positive frequencies with a certain kind of phase relationship (same amplitude and negated phase) so that the complex exponentials' imaginary parts cancel between negative and positive frequency.

Complex-valued signals are more general in that their spectra don't have to be symmetric around 0 Hz. The imaginary part helps you distinguish between positive and negative frequencies:

$$exp(f \cdot t \cdot i) = cos(f \cdot t) + i \cdot sin(f \cdot t)$$

As you can see above, the sign of f does not change the real part. But it does affect the sign of the imaginary part.

The second half of your FFT is the conjugate of the first half. Just plot the first half. The frequency resolution is 2048/N where N is the full FFT size.