The Discrete Fourier Transform

Scope and Background Reading

This session introduces the z-transform which is used in the analysis of discrete time systems. As for the Fourier and Laplace transforms, we present the definition, define the properties and give some applications of the use of the z-transform in the analysis of signals that are represented as sequences and systems represented by difference equations.

The material in this presentation and notes is based on Chapter 10 of Steven T. Karris, Signals and Systems: with Matlab Computation and Simulink Modelling, 5th Edition from the Required Reading List. Additional coverage is to be found in Chapter 12 of Benoit Boulet, Fundamentals of Signals and Systems from the Recommended Reading List.

Agenda

  • The discrete time fourier transform (DFT)
  • Even and Odd Properties of the DFT
  • Common Properties and Theorems of the DFT
  • Sampling Theorem, Windows, and the Picket Fence Effect

Introduction

  • Fourier series: periodic and continuous time function leads to a non-periodic discrete frequency function.
  • Fourier transform: non-periodic and continuous function leads to a non-periodic continuous frequency function.
  • Z and inverse Z-transforms produce a periodic and continuous frequency function, since they are evaluated on the unit circle.

In this session, we will see that a periodic and discrete time function results in a periodic and discrete frequency function.

For convenience we summarize these facts in a table:

Topic Time Function Frequency Function
Fourier Series Continuous, Periodic Discete, Non-Periodic
Fourier Transform Continuous, Non-Periodic Continuous, Non-Periodic
Z Transform Discrete, Non-Periodic Continuous, Periodic
Discrete Fourier Transform Discrete, Periodic Discrete, Periodic

List of Abbreviations

  • CT -- Continous Time
  • DT -- Discrete Time
  • DF - Discrete frequency
  • DFT -- Discrete (Time) Fourier Transform
  • FFT -- Fast Fourier Transform

Notation

In the following we shall denote a DT signal as $x[n]$ and its discrete frequency function as $X[m]$.

Z-Transform

Recall that

$$F(z) = \mathcal{Z} f[n] = \sum_{n=0}^{\infty} f[n]z^{-n}.$$

The value of this function on the unit circle in the Z-plane will be

$$F(e^{j\omega T}) = \sum_{n=0}^{\infty} f[n]e^{-jn \omega T}.$$

This is an infinite sum. So to compute it, we need to truncate it.

Let's assume that instead of an infinite number of points, we have $N$, equally distributed around the unit circle, then the truncated version will be:

$$X[m] = \sum_{n=0}^{N-1} x[n]e^{-j2\pi \frac{m n}{N}}$$

where

$$\omega = {\text{ }}\left( {\frac{{2\pi }}{{N}}} \right)m$$

and $m = 0,1,2,\ldots, N-1$.

We refer to the equation

$$X[m] = \sum_{n=0}^{N-1} x[n]e^{-j2\pi \frac{m n}{N}}$$

as the N-point Discrete-time Fourier Transform (DFT) of $x[n]$.

The inverse DFT is defined as

$$x[n] = \frac{1}{N} \sum_{m=0}^{N-1} X[m]e^{j2\pi \frac{m n}{N}}$$

for $n = 0,1,2,\ldots, N-1$.

Note the symmetry of the DFT and the Inverse DFT!

In general, the DFT is complex, and thus it can be expressed as

$$X[m] = \Re\left\{X[m]\right\} + \Im\left\{X[m]\right\}$$

for $m = 0,1,2,\ldots,N-1$.

Since

$$e^{-j2\pi \frac{m n}{N}} = \cos\left(\frac{2\pi m n}{N}\right) + j\sin\left(\frac{2\pi m n}{N}\right)$$

the DFT can be expresssed as

$$X[m] = \sum_{n=0}^{N-1} x[n]e^{-j2\pi \frac{m n}{N}} = \sum_{n=0}^{N-1}x[n]\cos\left(\frac{2\pi m n}{N}\right) + j\sum_{n=0}^{N-1}x[n]\sin\left(\frac{2\pi m n}{N}\right).$$

For $n=0$ this reduces to

$$X[m] = x[0].$$

Then the real part of $X[m]$ is

$$\Re \left\{ {X[m]} \right\} = x[0] + \sum\limits_{n = 1}^{N - 1} x [n]\cos \left( {\frac{{2\pi mn}}{N}} \right)\quad {\text{for}}\quad m = 0,1,2, \ldots ,N - 1$$

and the imaginary part is

$$\Im \left\{ {X[m]} \right\} = - \sum\limits_{n = 1}^{N - 1} x [n]\cos \left( {\frac{{2\pi mn}}{N}} \right)\quad {\text{for}}\quad m = 0,1,2, \ldots ,N - 1$$.

Example 1

A discrete time signal is defined by the sequence $x[0] = 1$, $x[1] = 2$, $x[2] = 2$, $x[3] = 1$, and $x[n]=0$ for all other values of $n$. Compute the frequency components $X[m]$.

Example 2

Use the inverse DFT to compute the discrete-time sequence $x[n]$ from $X[m]$.

See dft_ex10_1.slx

In [12]:
dft_ex10_1

MATLAB model of the DFT

Karris Example 10.1. To successfully run this script you will need to download the functions dft.m and idft.m and make them available on your MATLABPATH.

In [13]:
xn = [1, 2, 2, 1];
In [14]:
open dft
In [15]:
Xm = dft(xn,4)
Xm =

   6.0000 + 0.0000i  -1.0000 - 1.0000i   0.0000 - 0.0000i  -1.0000 + 1.0000i

In [16]:
open idft
In [17]:
xn = idft(Xm,4)
xn =

   1.0000 - 0.0000i   2.0000 - 0.0000i   2.0000 + 0.0000i   1.0000 + 0.0000i

A useful compact notation

The term $$e^{-j(2\pi)}/N$$ is a rotating vector where the range $0 <= \theta <= 2\pi$ is divided into $360/N$ equal segments.

It is convenient to represent this as $W_N$, that is $$W_N = e^{-\frac{j2\pi}{N}}$$ and consequently, $$W_N^{-1} = e^{\frac{j2\pi}{N}}.$$

Example 3

Compute the complex numbers represented by the rotating vector $W_8$

Using this notation, the DFT and inverse DFT pairs are represented as:

$$X[m] = \sum_{n=0}^{N-1} x[n]W_N^{nm}$$ and $$x[n] = \frac{1}{N}\sum_{n=0}^{N-1} x[n]W_N^{-nm}$$

Notes

In the remainder of these notes, the correspondence between $x[n]$ and $X[m]$ will be written

$$x[n] \Leftrightarrow X[m]$$

In example 2, we found that, although the DT sequence $x[n]$ was real, the discrete frequency (DF) sequence was complex. However, in most applications we are interested in the magnitude and phase of the DF, that is $$|X[m]|$$ and $$\angle X[m]$$.

Example 4

Use MATLAB to compute the magnitude of the frequency components of the following DT function:

$n$ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
$x[n]$ 1.0 1.5 2.0 2.3 2.7 3.0 3.4 4.1 4.7 4.2 3.5 3.6 3.2 2.9 2.5 1.8

We will compute this in class and make some comments afterwards.

In [18]:
xn = [ 1, 2, 3, 2.5, 1.5, 0.5,...
    -0.5, -1.5, -2.5, -0.5,...
    0.25, 1.25, 2, 1.5, 1, 0.5];
In [19]:
stem([0:15],xn),xlabel('n'),ylabel('x[n]'),title('Discrete Time Sequence')
In [20]:
Xm = dft(xn,16);
In [21]:
stem([0:15],abs(Xm)),xlabel('m'),ylabel('|X[m]|'),title('Discrete Frequency Sequence')

Even and Odd Properties of the DFT

The discrete time and discrete frequency functions are defined as even or odd in according to the following relations:

Even time function: $f[N - n] = f[n]$

Odd time function: $f[N - n] = -f[n]$

Even frequency function: $F[N - m] = F[m]$

Odd frequency function: $F[N - m] = -F[m]$

Even and odd properties of the DFT

Discrete time sequence $f[n]$ Discrete frequency sequence $F[m]$
RealComplex
Real part is Even
Imaginary part is Odd
Raal and EvenReal and Even
Raal and OddImaginary and Even
ImaginaryComplex
Real part is Odd
Imaginary part is Even
Imaginary and EvenImaginary and Even
Imaginary and OddReal and Odd

Common Properties and Theorems of the DFT

We denote the DFT and inverse DFT using as follows:

$$X[m] = \mathcal{D}\left\{x[n]\right\}$$

and

$$x[n] = \mathcal{D}^{-1}\left\{X[m]\right\}$$

We then state the following useful properties. For proofs, see Karris, 10.3. Not examined.

Linearity

$$a x_1[n] + b x_2[n] + \cdots \Leftrightarrow a X_1[m] + b X_2[m] + \cdots$$

Time-shift

$$x[n-k] \Leftrightarrow W_n^{km} X[m]$$

Frequency shift

$$W_n^{-km} x[n] \Leftrightarrow X[m-k]$$

Time convolution

$$x[n]*h[n] \Leftrightarrow X[m] H[m]$$

Frequency convolution

$$x[n]y[n] \Leftrightarrow \frac{1}{N}\sum_{k=0}^{N-1} X[k] Y[m - k] \Leftrightarrow X[m] * Y[m]$$

A summary of the important features of sampling and the DFT

  • $N$ is the number of samples in frequency.
  • $f_s$ sampling frequency, samples per seconds.
  • $T_t$ period of a periodic DT function.
  • $t_s$ interval between the $N$ samples in time period $T_t$.
  • $f_f$ period of a periodic DF function.
  • $F_s$ interval between the $N$ samples in frequency period $T_f$.

The relationships between these quantities are:

$$t_t = \frac{T_t}{N}$$

$$f_s = \frac{1}{t_t}$$

$$t_f = \frac{T_f}{N}$$

$$t_t = \frac{1}{T_f}$$

$$f_f = \frac{1}{T_t}$$

We will add these quantities to the results of Example 4 in class.

Example 5

The period of a periodic DT function is 0.125 ms and it is sampled at 1024 equally spaced points. It is assumed that with this number of samples, the sampling theorem is satisfied and thus there will be no aliasing.

  1. Compute the interval $t_t$ between samples for the periodic signal
  2. Compute the period $T_f$ of the frequency spectrum in kHz
  3. Compute the interval $t_f$ between frequency components in kHz
  4. Compute the sampling frequency $f_s$.
  5. Compute the Nyquist frequency $f_n$.

Summary

  • The discrete time fourier transform
  • Even and Odd Properties of the DFT
  • Common Properties and Theorems of the DFT
  • Sampling Theorem, Windows, and the Picket Fence Effect

Next session

  • The Fast Fourier Transform

(without the mathematics)

Homework

Try Exercise 1 and Exercise 2 in Karris 10.8 by hand.

For the exam, I wouldn't expect you to compute the whole sequence for a signal with more than 4 samples. However, you will need to be able to compute the DFT $x[n]$ and IDFT $X[m]$ of an 8-point sequence for any single value $n$ or $m$.