FFT of sine wave shows unexpected spectral widening

조회 수: 1 (최근 30일)
Eli Ratner
Eli Ratner 2020년 1월 29일
댓글: Eli Ratner 2020년 1월 29일
Trying this code:
res = 1024;
t = 1:res*90;
t = t/res;
FreqList = [ 0.1, 0.25, 0.5, 0.55, 1];
templeS = (10*sinpi(2*FreqList(1)*t));
for i = 2:numel(FreqList)
templeS=templeS+(10*sinpi(2*FreqList(i)*t));
end
ff = fft(templeS);
frq = 0:numel(t)-1;
frq = frq*res/numel(t);
figure;
plot(frq, abs(ff));
xlim([0,1.1]);
I expected to get sharp peaks at FreqList. However....
Can anyone explain this stange behavior of 0.25 and 0.55 frequencies?
BTW, i tryed also 0.24 and 0.56 without other frequencies, as well as different resolutions, with the same effect os spectral widening...

채택된 답변

Bjorn Gustavsson
Bjorn Gustavsson 2020년 1월 29일
Try this:
subplot(1,2,1)
plot(templeS)
axis tight
ax = axis;
axis([[-30 0]+ax(2) ax(3:4)])
subplot(1,2,2)
axis tight
plot(templeS)
axis tight
ax = axis;
axis([[0 6000]+ax(1) ax(3:4)])
Then you'll see that the function might be continuous around at the boundary, but its first derivative is not. Therefore the spectral widening. If you try the to select a period where your signal is nicely periodic you get much nicer peaks:
ff2 = fft(templeS(1:(89600)));
HTH
  댓글 수: 1
Eli Ratner
Eli Ratner 2020년 1월 29일
Thanks, but i get widening at other frequenciesi in this case. Of course, i can find the number of samples for complete period of all used frequencies, but it seems me incorrect way to work with real signals...
sines3.jpg
Indeed, i expected that the error of not whole cycle will be much smaller, because the number of cycles is large enough...

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by