FFT of sine wave shows unexpected spectral widening
1 view (last 30 days)
Show older comments
Eli Ratner
on 29 Jan 2020
Commented: Eli Ratner
on 29 Jan 2020
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...
0 Comments
Accepted Answer
Bjorn Gustavsson
on 29 Jan 2020
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
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!