why are the peaks of FFT of generated signal slighty off?
2 次查看(过去 30 天)
显示 更早的评论
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:
close
clear
clc
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);
figure;
subplot(1,2,1)
plot (t,x);
grid on;
nfft=8192;
Y = fft(x,nfft);
Y = Y(1:nfft/2);
mY=abs(Y);
f1 = (0:nfft/2-1)*fs/nfft;
subplot(1,2,2);
plot(f1,mY);
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?
0 个评论
回答(1 个)
Christoph F.
2017-12-4
Multiplying a function with another function can change the frequency content, as this corresponds to convolving the two image functions in the frequency domain.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Transforms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!