You are here

Discrete Fourier Transforms (DFT)

21 July, 2015 - 17:41

The discrete-time Fourier transform (and the continuous-time transform as well) can be evaluated when we have an analytic expression for the signal. Suppose we just have a signal, such as the speech signal used in the previous chapter, for which there is no formula. How then would you compute the spectrum? For example, how did we compute a spectrogram such as the one shown in the speech signal example (Figure 4.17: spectrogram)? The Discrete Fourier Transform (DFT) allows the computation of spectra from discrete-time data. While in discrete-time we can exactly calculate spectra, for analog signals no similar exact spectrum computation exists. For analog-signal spectra, use must build special devices, which turn out in most cases to consist of A/D converters and discrete-time computations. Certainly discrete-time spectral analysis is more flexible than continuous-time spectral analysis.

The formula for the DTFT (5.17) is a sum, which conceptually can be easily computed save for two issues.

  • Signal duration. The sum extends over the signal's duration, which must be fnite to compute the signal's spectrum. It is exceedingly difcult to store an infnite-length signal in any case, so we'll assume that the signal extends over [0,N − 1].
  • Continuous frequency. Subtler than the signal duration issue is the fact that the frequency variable is continuous: It may only need to span one period, like \left [ -\left ( \frac{1}{2} \right ),\frac{1}{2} \right ] or [0, 1], but the DTFT formula as it stands requires evaluating the spectra at all frequencies within a period. Let's compute the spectrum at a few frequencies; the most obvious ones are the equally spaced ones f=\frac{k}{K},\ k\in \begin{Bmatrix} 0,\cdots ,K-1 \end{Bmatrix}

We thus define the discrete Fourier transform (DFT) to be

S(k)=\sum_{n=0}^{N-1}\left ( s(n)e^{-\left ( \frac{j2 \pi n k}{K} \right )} \right )\;,\;k\in \left \{ 0,...,K-1 \right \}

Here, S(k) is shorthand for S\left ( e^{j2 \pi \frac{k}{K}} \right ).

We can compute the spectrum at as many equally spaced frequencies as we like. Note that you can think about this computationally motivated choice as sampling the spectrum; more about this interpretation later. The issue now is how many frequencies are enough to capture how the spectrum changes with frequency. One way of answering this question is determining an inverse discrete Fourier transform formula: given S(k), k = {0,...,K − 1} how do we find s(n), n = {0,...,N − 1}? Presumably, the formula will be of the form s(n)=\sum_{k=0}^{K-1}\left ( S(k)e^{\frac{j2\pi nk}{K}} \right ). Substituting the DFT formula in this prototype inverse transform yields

s(n)=\sum_{k=0}^{K-1}\left ( \sum_{m=0}^{N-1}\left ( s(m)e^{-(j\frac{2\pi mk}{K})}e^{j\frac{2\pi nk}{K}} \right ) \right )

Note that the orthogonality relation we use so often has a different character now.

\sum_{k=0}^{K-1}\left ( e^{-(j\frac{2\pi km}{K})}e^{j\frac{2\pi kn}{K}} \right ) = \left\{\begin{matrix} K\: if\: m=\left \{ n,\left ( n\pm K \right ),\left ( n\pm 2K \right ),... \right \}\\ 0\: otherwise \end{matrix}\right.

We obtain nonzero value whenever the two indices difer by multiples of K. We can express this result asK\sum _{l}\left ( \delta (m-n-lK) \right ).Thus, our formula becomes

s(n)=\sum_{m=0}^{N-1}\left ( s(m)K\sum_{l=-\infty }^{\infty }\left ( \delta (m-n-lK) \right ) \right )

The integers n and m both range over {0,...,N − 1}. To have an inverse transform, we need the sum to be a single unit sample for m, n in this range. If it did not, then s (n) would equal a sum of values, and we would not have a valid transform: Once going into the frequency domain, we could not get back unambiguously! Clearly, the term l =0 always provides a unit sample (we'll take care of the factor of K soon). If we evaluate the spectrum at fewer frequencies than the signal's duration, the term corresponding to m = n + K will also appear for some values of m, n = {0,...,N - 1}. This situation means that our prototype transform equals s (n) + s (n + K) for some values of n. The only way to eliminate this problem is to require K ≥ N: We must have at least as many frequency samples as the signal's duration. In this way, we can return from the frequency domain we entered via the DFT.

Exercise 5.7.1

When we have fewer frequency samples than the signal's duration, some discrete-time signal values equal the sum of the original signal values. Given the sampling interpretation of the spectrum, characterize this effect a different way.

Another way to understand this requirement is to use the theory of linear equations. If we write out the expression for the DFT as a set of linear equations,


s(0)+s(1)e^{(-j)\frac{2\pi}{K}}+...+s(N-1)e^{(-j)\frac{2\pi (N-1)}{K}}=S(1)


s(0)+s(1)e^{(-j)\frac{2\pi (K-1)}{K}}+...+s(N-1)e^{(-j)\frac{2\pi (N-1)(K-1)}{K}}=S(K-1)

we have K equations in N unknowns if we want to find the signal from its sampled spectrum. This require ment is impossible to fulfll if N; we must have K ≥ N. Our orthogonality relation essentially says that if we have a sufcient number of equations (frequency samples), the resulting set of equations can indeed be solved.

By convention, the number of DFT frequency values K is chosen to equal the signal's duration N. The discrete Fourier transform pair consists of

Discrete Fourier Transform Pair

\begin{align*} S(k)&=\sum_{n=0}^{N-1}\left ( s(n)e^{-(j\frac{2\pi nk}{N})} \right )\\ s\left ( n \right )&=\sum_{k=0}^{N-1}\left ( S\left ( k \right )e^{j\frac{2\pi nk}{N}} \right )\\ \end{align*}

Example 5.3

Use this demonstration to perform DFT analysis of a signal.

This media object is a LabVIEW VI. Please view or download it at


Example 5.4

Use this demonstration to synthesize a signal from a DFT sequence.

This media object is a LabVIEW VI. Please view or download it at