# Minimum number of data points needed for a DFT to avoid spectrum leakage?

Let $x(t) = 0.4 + 0.5 \cos (2 \pi f_1 t) + 2 \cos (2\pi f_2 t) + \sin(2 \pi f_2 t) + 1.5 \cos(2\pi f_3 t)$ where $f_1 = 3 kHz, f_2 = 5 kHz, f_3 = 8 kHz$. If $x[n]$ is obtained by sampling $x(t)$ with a sampling frequency of $f_s = 16 kHz$ what is the minimum number of data points needed for a DFT in order to resolve all the frequencies without spectrum leakage?

Can someone point me in the right direction on this?

UPDATE work:

With $f_s = 16000, T_s = \frac{1}{16000}$, we have:

\begin{align*} x(t) &= 0.4 + 0.5 \cos (2 \pi f_1 t) + 2 \cos (2\pi f_2 t) + \sin(2 \pi f_2 t) + 1.5 \cos(2\pi f_3 t) \\ x[n] &= 0.4 + 0.5 \cos (2 \pi \frac{3}{16} n) + 2 \cos (2\pi \frac{5}{16} n) + \sin(2 \pi \frac{5}{16} n) + 1.5 \cos(2\pi \frac{1}{2} n) \\ \end{align*}

The discrete periods would be $\frac{16}{3}, \frac{16}{5}, 2$, right?

• Since f3 isn't below half the sampling rate, even an infinite number of samples might not be enough. Trick question perhaps? – hotpaw2 Oct 29 '15 at 7:38
• @MattL. Let's call the whole thing off! :-) – Peter K. Oct 29 '15 at 9:36

What you're actually asked to do is find the periods of the discrete-time sinusoids, and choose a DFT-length, such that all sinusoids occur an integer number of periods inside that window, hence no spectral leakage will occur.

I leave it as an exercise for you to determine the periods of the sampled sinusoids, but the end result of the DFT looks like this:

You can see that all frequencies are clearly resolved.

The problem (mentioned in the comments) of one sinusoid being located at exactly the Nyquist frequency (half the sampling rate) is not relevant for this toy example, even though in practice it is. What it means is that that sinusoid cannot generally be reconstructed uniquely. However, in your DFT you can see that there's a component at that frequency, and that's all they asked for.

• You show a 9 point DFT... Where do you get the 9 from? I calculated the discrete periods in the main question and I don't see how those lead to 9. – clay Oct 29 '15 at 15:50
• @clay: No, I just showed the 9 non-redundant points of a 16-point DFT. Note that the DFT is symmetric for real-valued signals, so if you have indices from 0 to 15, index 15 corresponds to index 1, 14 to 2, etc., so the indices from 0 to 8 contain all the information. – Matt L. Oct 29 '15 at 17:38