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!