why are the peaks of FFT of generated signal slighty off?

1 view (last 30 days)
Viktor von den Brincken
Viktor von den Brincken on 4 Dec 2017
Answered: Christoph F. on 4 Dec 2017
I want to generate a signal of fixed length with two dampened frquency components 2 and 8. Then I would like to identify these frequencies using fft. Unfortunately, regarding the magnitude-frequency domain, the determined frequencies seem slightly off.
my code:
fs = 800; %sampling frequency
ts = 10; %signal length
efq1 = 2; %frequencies 2 and 8
efq2 = 8;
t = 0:1/fs:ts; %vector length
w1 = 2*pi*efq1; %pulsatances
w2 = 2*pi*efq2;
x = exp(-0.1.*w1.*t).*20.*sin(w1.*t)+exp(-0.2.*w2.*t).*50.*sin(w2.*t);
plot (t,x);
grid on;
Y = fft(x,nfft);
Y = Y(1:nfft/2);
f1 = (0:nfft/2-1)*fs/nfft;
grid on;
in the attached image you see the amplitude-time domain and the magnitude-frequency domain, zoomed in to visualize the deviation. can you tell me why this is and how to eliminate the deviation?

Answers (1)

Christoph F.
Christoph F. on 4 Dec 2017
Multiplying a function with another function can change the frequency content, as this corresponds to convolving the two image functions in the frequency domain.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!