I have a simple signal which is the sum of three sinusoids of frequencies 50 Hz, 100 Hz and 100400 Hz. The signal is sampled at 1000 Hz. The output of the FFT function, besides containing the 50 Hz and 100 Hz frequency components, also contains a 400 Hz frequency component which does not exist in the original signal. The code is provided below:
Fs = 1000; % Sampling rate
T = 1/Fs; % Sample time
L = 1000; % Length of signal
t = (0:L-1)*T; % Time vector
third_frequency=100400;y = 0.7*sin(2*pi*50*t) + sin(2*pi*100*t) + 2*sin(2*pi*third_frequency*t); NFFT = 2^nextpow2(L); % Next power of 2 from length of y
Y = fft(y,NFFT)/L;f = Fs/2*linspace(0,1,NFFT/2);% Plot single-sided amplitude spectrum.
plot(f,2*abs(Y(1:NFFT/2))) title('Single-Sided Amplitude Spectrum of y(t)')xlabel('Frequency (Hz)')ylabel('|Y(f)|')
Best Answer