0
$\begingroup$

I am experimenting with digital signal processing and I took the FFT of a sinusoid in Matlab. I got the frequency components that I expected to be present but there are two excess spikes that mirror them. Are these reflections of the negative frequencies present in a sinusoidal spectrum that I didn't account for in my code or are they present in the signal?

Code:

Fs = 1e9;            % Sampling frequency                    
T = 1/Fs;             % Sampling period       
L = 1500;             % Length of signal
t = (0:L-1)*T;        % Time vector

S = cos(2*pi*200e6*t) + cos(2*pi*400e6*t);
Y = fft(S);
plot(Fs/L*(0:L-1),abs(Y),"LineWidth",3)
title("Magnitude of fft Spectrum")
xlabel("(Hz)")
ylabel("|fft(signal)|")

Result:

enter image description here

$\endgroup$
1
  • 2
    $\begingroup$ Yes, these are reflections. If you fftshift the output and plot from Fs/L*(-L/2:L/2-1) you should see spikes at +/- the frequencies of interest. $\endgroup$
    – Baddioes
    Commented Feb 12 at 23:05

0

Browse other questions tagged or ask your own question.