# Why am I getting 2 frequency spikes in a mono tone signal?

I have a single tone sinusoid, and its fft in scilab is giving me double spikes, why is that?

Please explain me the concept of why is it happening.

clf();
fs=1000;
t=0:1/fs:0.2;
L=length(t);
f=((0:1:L-1)*fs)/L;
l=length(f);
fm=40;
s=sin(2*%pi*fm*t);
plot(t,s)
S=fft(s)
S_abs=abs(S)
figure(2)
plot(f(1:l),S_abs)

Welcome!

Actually, in your case windowing only affects the width of your pulse (as you see, your peaks are not impulsive). You can see the difference by just increasing the temporal length of your signal (equivalent to increase the width of your window, assuming that the original signal is the infinite length sinusoid) and taking the fft. The longer your signal, the narrower your pulse.

What causes the double peaks is that the fft function returns the double-sided transform of the signal you are considering. This means that the first half of S contains the positive bandwidth (from 0 to fs/2), while the second half is just its mirrored version (mathematically, this is equivalent to the spectrum from -fs/2 to 0).

Details are given in the fft documentation by Mathworks.

• I understood the concept of double sided spectrum, but usually double sided spectrum is from -ve to +ve ryt? Here i am i getting both in positive? Aug 25 at 13:08
• You are saying that its due to conjugate symmetry but i am plotting the fft from 0, then how can the spike which originally supposed to be in -ve side appear in positive axis? Aug 25 at 13:19
• From theory we know that FFT is periodic, therefore you are actually looking at one period of the FFT for your signal. You are plotting your fft from 0, good! So you are looking at your fft from 0 to fs. Now, if you wish to visualize the negative part of the spectrum, you can move the portion from fs/2 to fs BEFORE 0 and then consider the x-axis from -fs/2 to fs/2 instead of from 0 to fs. There is no problem in doing that due to periodicity of FFT, it is just a matter of visualization (user's choice!) Aug 25 at 14:04
• Okok thankyou verymuch, i got it Aug 25 at 14:20

You're experiencing a basic property of the DFT of a real input signal, that it is conjugate symmetric:

Let $$x[n], \, n = 0\cdots N-1$$ be a real-valued sequence, then the DFT coefficients are conjugate symmetric: $$X[k] = \overline{X[N-k]},\,k = 0\cdots N-1$$

For analysis, we usually discard half of the spectrum because the information is therefore redundant:

figure(2)
S_abs = S_abs(1:(l+1)/2);
f = (0:(L-1)/2)*fs/L;
plot(f,S_abs)

Proof of conjugate symmetry:

\begin{align} X[N-k] &= \sum_{n=0}^{N-1}x[n]e^{-j2\pi \frac{N-k}{N}n}\\ &= \sum_{n=0}^{N-1}x[n]e^{+j2\pi \frac{k-N}{N}n}\\ &= \sum_{n=0}^{N-1}x[n]e^{+j2\pi \frac{k}{N}n}e^{-j2\pi n}\quad \left(e^{-j2\pi n} = 1\right)\\ &= \sum_{n=0}^{N-1}x[n]\overline{e^{-j2\pi \frac{k}{N}n}}\\ &= \sum_{n=0}^{N-1}\overline{x[n]e^{-j2\pi \frac{k}{N}n}}\\ &= \overline{X[k]} \end{align}

Where the last step stems from the fact that $$x[n]$$ is real so $$x[n] = \overline{x[n]}$$