# Is spectral leakage due to windowing 'different' for the DTFT and DFT?

I'm currently trying to improve my foundational understanding of spectral leakage due to windowing. The more I have been reading about it, the more I'm starting to think that 'windowing spectral leakage' can mean two completely different things depending on whether you're talking about the DTFT or DFT. I'm hoping to get some confirmation/clarification on what I discuss.

1. With regards to the DTFT, this transform is essentially the Fourier transform equivalent for a discrete signal. This transform assumes that the signal is periodic with that period being infinity. With regards to windowing, spectral leakage is induced due to the fact that you are multiplying a discrete signal $x[n]$, by some window function $w[n]$. The corresponding convolution in the frequency domain causes the spectrum of $X[f]$ to be smeared or 'leaked'.

2. Now moving onto the DFT, the idea of spectral leakage induced by windowing seems to be a completely different concept. Unlike the DTFT, the DFT assumes the signal is periodic (with that period being less than infinity). In this context, it is often stated that spectral leakage will occur if the collected signal does not contain an integer multiple number of points to the digital frequencies contained (i.e. if you have a $3\textrm{ Hz}$ signal with sample rate $10$ samples/sec, and collect $18$ samples, you will have spectral leakage). Thus if you recorded a sinusoid at interval where it's not able to 'finish' a complete cycle, the next period will restart and there will be a discontinuity in the signal. While this makes sense that you would be inducing 'false' frequencies or leaking frequencies, it seems to be a completely different idea from the convolving concept of the DTFT.

My primary question:

• Is 'window spectral leakage' completely dependent on context (DTFT vs DFT)?

• Furthermore, is it safe to say that the spectral leakage induced by each case separate from one another? As in, spectral leakage from the DTFT is induced by frequency convolution, and spectral leakage from the DFT induced by the assumption of periodicity? Or is there something that ties these two things together?

• The DFT itself makes no assumption of periodicity. That is a user assumption. A user might make different assumptions, such as in the case of overlapped DFT windows of audio recordings.. Sep 12 '16 at 20:38
• @hotpaw2 If you were to perform the inverse DFT on the frequency spectrum obtained by the DFT, would it not be a periodic signal?
– Izzo
Sep 12 '16 at 20:39
• @hotpaw2 No need to answer that question, it appears to be a highly controversial issue from a few quick searches.
– Izzo
Sep 12 '16 at 21:32
• yes, @hotpaw2 is categorically incorrect with the assertion: "The DFT itself makes no assumption of periodicity." since people accuse me of "anthropomophizing" the DFT when i say it does assume periodicity, i will reword it as:  The Discrete Fourier Transform periodically extends the finite sequence of data passed to it. The DFT and the Discrete Fourier Series are one-and-the-same. The DFT (and DFS) transform a discrete and periodic sequence in one domain to another unique discrete and periodic sequence in the reciprocal domain. And the iDFT transforms it back.  Sep 12 '16 at 22:09
• and, to avoid repeating myself, i refer to this older answer about it. it is not up to the user as to whether the DFT periodically extends the finite-length input sequence passed to it. the DFT does that whether the user assumes so or not. this is why modulo-$N$ indexing must be used for the DFT theorems (except for the linearity theorems, which cause no shifting, but then the modulo-$N$ addressing doesn't hurt, so it can be assumed for all theorems). Sep 12 '16 at 22:19

The concept of spectral leakage is not dependent on the context, and it's the same thing for the DTFT as it is for the DFT. It's probably helpful to remember that the DFT of a finite length sequence equals a sampled version of the DTFT of the same sequence:

\begin{align}X(\omega)&=\sum_{n=0}^{N-1}x[n]e^{-jn\omega}\qquad\text{(DTFT)}\\ \tilde{X}[k]&=\sum_{n=0}^{N-1}x[n]e^{-jn\frac{2\pi k}{N}}\qquad\text{(DFT)}\end{align}

Obviously we have

$$\tilde{X}[k]=X\left(\frac{2\pi k}{N}\right)$$

Now assume we have two sinusoidal signals windowed with a rectangular window such that in one case there's an integer number of periods inside the window, and in the other cases there isn't:

In both cases we get spectral leakage due to the windowing process. However, in the first case, the samples of the DTFT computed by the DFT are all at the zeros of the DTFT (except for one sample at the sinusoid's frequency). This is not the case for the second signal. That means that in the first case the DFT doesn't "see" the spectral leakage due to the sampling process, but in the other case the spectral leakage is also visible in the DFT.

These two cases are shown in the figure below. The DTFT is shown in blue, and the corresponding DFT is in red:

• Very interesting... You're essentially saying the DTFT is what introduces the spectral leakage and it is the DFT that occasionally uncovers the spectral leakage.
– Izzo
Sep 13 '16 at 13:20
• @Teague: Windowing is what introduces spectral leakage. The DTFT always makes it visible, whereas the DFT being a sampled version of the DTFT might make it seem to disappear. Sep 13 '16 at 13:26
• it's important to not that the DTFT above is with the assumption of zero-padding the finite set of data:\begin{align} X(\omega)& \triangleq \sum_{n=-\infty}^{+\infty}x[n]e^{-jn\omega}\\ &=\sum_{n=0}^{N-1}x[n]e^{-jn\omega}\\ \end{align} only if $x[n]=0$ for $n<0$ or $n \ge N$. so $$\tilde{X}[k]=X\left(\frac{2\pi k}{N}\right)$$ is true only with that specific assumption, which is the same as windowing the stream of data with a rectangular window. Sep 13 '16 at 15:05
• Matt, you usually don't like it when i modify your answers, but another way to look at is is that the spectrum on the bottom is precisely the correct spectrum for the corresponding waveform above it that is periodically extended. i .e. there would be a small non-zero DC and 1st harmonic, lotsa 2nd harmonic, some 3rd harmonic, and small non-zero higher harmonics.. this is for a waveform that makes 2.5 sinusoidal cycles, has a discontinuity, and repeats the 2.5 sinusoidal cycles. Sep 13 '16 at 15:13
• kewl. was small potatoes but the indices will now appear to agree with the equations for $N$=64. also, i meant to say *"2.25 sinusoidal cycles, discontinuity, and repeat"* for the periodic extension of the data in the bottom signal. so you can think of the DFT as zero-extending the data, applying the DTFT, and sampling the DTFT $X(\omega)$ or it can be the true 1st and 2nd and 3rd (etc.) harmonics of that periodically-extended $N$-sample input to the DFT. there is no way one can rule out either interpretation of the output of the DFT, $X[k]$. and when you apply theorems, $X[k+N]=X[k]$. Sep 13 '16 at 20:30

No. Not always. They can both be the result of rectangular (or other) windowing. Any DFT of real world data usually implies a default window, since the actual time origin is several Billion years ago, and hopefully time will continue a few Billion more. Most DFTs are much much shorter in length (thus windowed). And not all phenomena from the real world is absolutely periodic.

• windowing is not an action taken by the DFT nor the DTFT. neither the DFT nor the DTFT window one's data. windowing happens when one selects a finite subset out of an infinite stream of samples (that had its origin and end billions of years from now) before either the DFT or DTFT ever sees the (truncated) data. that's when windowing happens. it's not when the DFT nor DTFT processes the data. Sep 13 '16 at 5:09
• Agreed. Therefore if the user makes assumptions that are inconsistent with the fact that the DFT operated on a finite subset of longer data, they will draw false conclusions. Sep 13 '16 at 5:47