# Getting two components for one frequency in FFT

1 view (last 30 days)
632541 on 21 Apr 2021
Commented: Bjorn Gustavsson on 21 Apr 2021
Hi,
I'm getting 2 freq in fft .
But I have signal at 1MHz. Getting peak at 999000 and next is at 1MHz.(other frequencies are also there , 10k, 50k, 500k. For these peak is same as signal frequency.)
Sampling freq is 5MPs.
What is happening at 1MHz ?
Any reason for this?
Thank you..
632541 on 21 Apr 2021
Here is the code i have written .
Number of samples= 50000 samples.
fs=50000000; %Sampling frequency
nfft=length(m);
%nfft=2^nextpow2(nfft);
X=fft(m,nfft); %FFT of the signal
X=X(1:nfft/2);
%take magniutde
mx=abs(X);
f=(0:(nfft/2)-1)*fs/nfft; %Frequency range
figure(1);
n=50000;
t=0:1:(n-1);
plot(t,m);
title('Multisine')
xlabel('Samples')
ylabel('Amplitude');
figure(2)
plot(f,mx);
title('FFT of signal')
xlabel('Frequency')
ylabel('Amplitude');
632541 on 21 Apr 2021
Any code alterations needed?
Or other solution?

Bjorn Gustavsson on 21 Apr 2021
The fft is a circular Fourier transform, there will always be some spectral leakage from frequencies that are not exactly periodic over your data-sample-array. That is what you see here.
HTH
632541 on 21 Apr 2021
Thanks Bjorn Gustavsson.
Will you please have a glance at code.
The input signal is discrete ,has 50000 samples.
like,m=[ 0 58 ..........]
Bjorn Gustavsson on 21 Apr 2021
Code looks OK, share the input signal for more detailed answer.