0

Why does a pure sine wave starting and ending at 0 in the sample window of a DFT but containing 1.5 cycles (or periods) produce the same spectral leakage (i.e. not more) as a pure sine wave with integer number of periods in the sample window of a DFT.

BillO
  • 1
  • The integer number of periods (of a pure sinewave) has to be equal to the length of the DFT (e.g. N, not (N-1)), for the DFT result to end up in a single bin. – hotpaw2 Jun 12 '16 at 15:33

1 Answers1

1

That's not true. Take a simple example:

N = 8; n = 0:N-1;
w1 = pi/4; w2 = 3*pi/8;
s1 = sin(n*w1); s2 = sin(n*w2);
S1 = fft(s1); S2 = fft(s2);
subplot(2,2,1),stem(n,s1)
subplot(2,2,2), stem(n,s2)
subplot(2,2,3), stem(n,abs(S1))
subplot(2,2,4), stem(n,abs(S2))

enter image description here

Matt L.
  • 89,963
  • 9
  • 79
  • 179
  • Thank you Matt for the great answer - so when I see in a Matlab DFT Demo a similar result for Integer and Integer and a half, but much worse for integer and 1/3, 1/4 etc does it mean that 1.5 integer cycles is the least worst case for discontinuities (i.e. sig is at 0 - no "corner " so less high freq content ), and a window is optimised to make it look as good as an integer cycle case? – BillO Jun 12 '16 at 19:32
  • @BillO: You're right; think about it in continuous time: 1.5 periods result in no discontinuity (only a discontinuity in the derivative), whereas in the other cases you have a discontinuity leading to large spectral leakage. – Matt L. Jun 12 '16 at 19:36
  • @BillO: Also take a look at this answer to a related question. – Matt L. Jun 12 '16 at 19:39
  • Thanks again Matt for the informative answer - aploogies for more questions but I wonder how does the cyclical nature of the DFT (in that sample 0 is considered adjacent to last sample N) cope with the discontinuity in derivative? Is it because it the derivative is no different in magnitude but only in sign (i.e. +ve to -ve or vice versa). Is the spectral leakage you see with 1.5 integer periods due to the extra quanity of +ve (or-ve) sig energy not being cancelled out by its inverse (i.e. the missing half cycle)? – BillO Jun 16 '16 at 17:50