7  The Fourier Transforms

7.1 Exercise 1

Find the DTFT of the signal \(\{..., 0, \underuparrow{1}, 1, 1, 0, 0, ...\}\)

  • a). Write the expression of \(|X(\omega)|\) and \(\angle{X(\omega)}\)
  • b). What is the signal’s spectrum (modulus and phase) at frequency \(f=\frac{1}{2}\)?

Solution

a). Write the expression of \(|X(\omega)|\) and \(\angle{X(\omega)}\)

We apply the definition of the DTFT: \[X(\omega) = \sum_{n=-\infty}^{\infty} x[n] e^{-j\omega n}\]

Our signal \(x[n]\) has non-zero values only for \(n=0,1,2\), so we can restrict the sum to these three terms: \[\begin{aligned} X(\omega) &= \sum_{n=0}^{2} x[n] e^{-j\omega n} \\ &= x[0] e^{-j\omega 0} + x[1] e^{-j\omega 1} + x[2] e^{-j\omega 2} \\ &= 1 + e^{-j\omega} + e^{-j2\omega} \end{aligned}\]

Using the Euler formula: \[\begin{aligned} e^{j\omega} &= \cos(\omega) + j \sin(\omega) \\ e^{-j\omega} &= \cos(-\omega) + j \sin(-\omega) = \cos(\omega) - j \sin(\omega) \end{aligned}\] we can write: \[\begin{aligned} X(\omega) &= 1 + e^{-j\omega} + e^{-j2\omega} \\ &= 1 + (\cos(-\omega) + j \sin(-\omega)) + (\cos(-2\omega) + j \sin(-2\omega)) \\ &= 1 + \cos(\omega) - j \sin(\omega) + \cos(2\omega) - j \sin(2\omega) \\ &= 1 + \cos(\omega) + \cos(2\omega) - j (\sin(\omega) + \sin(2\omega)) \end{aligned}\]

The real part is \(1 + \cos(\omega) + \cos(2\omega)\), the imaginary part is \((- \sin(\omega) - \sin(2\omega))\), and therefore the modulus and the phase are: \[\begin{aligned} |X(\omega)| &= \sqrt{(1 + \cos(\omega) + \cos(2\omega))^2 + (\sin(\omega) + \sin(2\omega))^2} \\ \angle{X(\omega)} &= \arctan\left(\frac{- \sin(\omega) - \sin(2\omega)}{1 + \cos(\omega) + \cos(2\omega)}\right) \end{aligned}\]

Just for fun, we can plot these functions here:

Code
import numpy as np
import matplotlib.pyplot as plt
#%matplotlib inline
plt.rcParams['text.usetex'] = True

w = np.linspace(-np.pi, np.pi, 1000)
X = 1 + np.cos(w) + np.cos(2*w) - 1j*(np.sin(w) + np.sin(2*w))

plt.figure(figsize=(6, 2))
plt.plot(w, np.abs(X))
plt.xlabel(r'$\omega$')
plt.ylabel(r'$|X(\omega)|$')
plt.title('Modulus of the DTFT transform of the signal')
plt.tight_layout()

plt.figure(figsize=(6, 2))
plt.plot(w, np.angle(X))
plt.xlabel(r'$\omega$')
plt.ylabel(r'$\angle{X(\omega)}$')
plt.title('Phase of the DTFT transform of the signal')

plt.tight_layout()

b). What is the signal’s spectrum (modulus and phase) at frequency \(f=\frac{1}{2}\)?

We have to evaluate the expressions for \(|X(\omega)|\) and \(\angle{X(\omega)}\) at \(\omega = 2\pi f = 2 \pi \frac{1}{2} = \pi\):

\[\begin{aligned} |X(\pi)| &= |X(\omega) \big|_{\omega=\pi} = \sqrt{(1 + \cos(\pi) + \cos(2\pi))^2 + (\sin(\pi) + \sin(2\pi))^2} = 1 \\ \angle{X(\pi)} &= \angle{X(\omega)} \big|_{\omega=\pi} = \arctan\left(\frac{- \sin(\pi) - \sin(2\pi)}{1 + \cos(\pi) + \cos(2\pi)}\right) = \arctan(0) = 0 \end{aligned}\]

7.2 Exercise 2

Compute the circular convolution of the two signals: \[x_1[n] = [1, 3, 1, 3]\] \[x_2[n] = [2, 2, 5, 5]\]

Solution

We can use the definition of the circular convolution: \[y[n] = x_1[n] \circledast x_2[n] = \sum_{m=0}^{N-1} x_1[m] x_2[(n-m) \mod N]\]

where \(N\) is the length of the signals. In this case, \(N=4\).

We follow the same procedure as when calculating the linear convolution, but the indices (positions) are wrapped by \(N\). When we exceed the length of the signal, we shift the position back to the beginning.

Circular convolution vs linear convolution

The result is a sequence with the same length as the input sequences, \(N=4\): \[y[n] = x_1[n] \circledast x_2[n] = [28, 28, 28, 28]\]

WarningCoincidence

It is only a coincidence that all the values of \(y[n]\) are equal here, \([28, 28, 28, 28]\). In general, the result could be anything.

TipGeneralizations
  • If the two signals have different lengths, we append zeros to the shorter one until both have the same length.

  • We can pick any value if \(N\) longer than the signals. In this case, we extend both signals with zeros until the prescribed length. This is called the circular convolution in N points.

    Homework: compute the circular convolution of these signals in \(N=6\) points.

  • If \(N\) is large enough, the circular convolution becomes the linear convolution. \(N\) must be larger than \(Length_1 + Length_2 - 1\).

    Homework: compute the circular convolution of these signals in \(N=7\) points.

7.3 Exercise 3

Compute the circular convolution in \(N = 7\) points of the same two signals

Solution

We must append zeros to both signals to make their length 7, then do circular convolution as before.

Surprise: we obtain the same result as linear convolution.

7.4 Exercise 4

Consider a periodic signal \(x[n]\) with period \(N=6\) and the DFT coefficients:

\(X_k\) = [21.0000 + 0.0000i , -3.0000 + 5.1962i , -3.0000 + 1.7321i , -3.0000 + 0.0000i , -3.0000 - 1.7321i , -3.0000 - 5.1962i]

Write \(x[n]\) as a sum of sinusoids.

Solution

We know the connection between the DFT coefficients and the cosine components of the signal, from the theory:

  • if \(N\) is odd: \[x[n] = \frac{1}{N} X_0 + \frac{1}{N} \sum_{k=1}^{(N-1)/2} 2 |X_k| \cos\left( 2\pi \frac{k}{N} n + \angle{X_k}\right)\]
  • if \(N\) is even: \[x[n] = \frac{1}{N} X_0 + \frac{1}{N} \sum_{k=1}^{N/2-1} 2 |X_k| \cos\left( 2\pi \frac{k}{N} n + \angle{X_k}\right) + \frac{1}{N} |X_{N/2}| \cos\left( \pi n + \angle{X_{N/2}}\right)\]

In our case we have \(N=6\), so we use the second formula.

We compute the modulus and phase of the DFT coefficients:

  • \(X_0 = 21\): is a real number, positive
    • \(|X_0| = 21\)
    • \(\angle{X_0} = 0\)
  • \(X_1 = -3.0000 + j5.1962\):
    • \(|X_1| = \sqrt{(-3)^2 + 5.1962^2} = ...\)
    • \(\angle{X_1} = \arctan\left(\frac{5.1962}{-3}\right) = ...\)
  • \(X_2 = -3.0000 + j1.7321\):
    • \(|X_2| = \sqrt{(-3)^2 + 1.7321^2} = ...\)
    • \(\angle{X_2} = \arctan\left(\frac{1.7321}{-3}\right) = ...\)
  • \(X_3 = -3\) is a real number, negative
    • \(|X_3| = 3\)
    • \(\angle{X_3} = \pi\)
  • \(X_4 = X_{4-N} = X_{-2} = X_{2}^*\)
    • \(|X_4| = |X_2| = ...\)
    • \(\angle{X_4} = -\angle{X_2} = ...\)
  • \(X_5 = X_{5-N} = X_{-1} = X_{1}^*\)
    • \(|X_5| = |X_1| = ...\)
    • \(\angle{X_5} = -\angle{X_1} = ...\)

Compute these values and replace in the formula.

TipComplex conjugates

It is not a coincidence that \(X_4 = X_2^*\) and \(X_5 = X_1^*\). If the signal \(x[n]\) has real values, then there is always this complex conjugate property, because the DFT coefficients are even: \[X_k = X_{k-N} = X_{N-k}^*\]

7.5 Exercise 5

Consider a periodic signal \(x[n]\) with period \(N=5\) and the DFT coefficients:

\(X_k\) = [15.0000 + 0.0000i , -2.5000 + 3.4410i , -2.5000 + 0.8123i , -2.5000 - 0.8123i , -2.5000 - 3.4410i]

Write \(x[n]\) as a sum of sinusoids.

Solution

This is similar to the previous exercise, but we have \(N=5\), so we use the formula for odd \(N\).

We have:

  • \(X_0 = 15\): is a real number, positive
    • \(|X_0| = 15\)
    • \(\angle{X_0} = 0\)
  • \(X_1 = -2.5000 + j3.4410\):
    • \(|X_1| = \sqrt{(-2.5)^2 + 3.4410^2} = ...\)
    • \(\angle{X_1} = \arctan\left(\frac{3.4410}{-2.5}\right) = ...\)
  • \(X_2 = -2.5000 + j0.8123\):
    • \(|X_2| = \sqrt{(-2.5)^2 + 0.8123^2} = ...\)
    • \(\angle{X_2} = \arctan\left(\frac{0.8123}{-2.5}\right) = ...\)

Compute these values and replace in the formula.

7.6 Exercise 6

Find the DFT coefficients of the periodic signal with period \(\{1, 1, 0, 0\}\), and write the signal as a sum of sinusoidal components.

Solution

First, we use the definition of the DFT to compute the DFT coefficients.: \[X_k = \sum_{n=0}^{N-1} x[n] e^{-j 2\pi \frac{k}{N} n}, k=0,1,...,N-1\]

Here \(N=4\), so we have to compute 4 sums \(X_k\), each with 4 terms.

\[\begin{aligned} X_0 &= \sum_{n=0}^{3} x[n] e^{-j 2\pi \frac{0}{4} n}\\ &= x[0] + x[1] + x[2] + x[3] \\ &= 2 \end{aligned}\]

\[\begin{aligned} X_1 &= \sum_{n=0}^{3} x[n] e^{-j 2\pi \frac{1}{4} n}\\ &= x[0] + x[1] e^{-j \pi/2} + x[2] e^{-j \pi} + x[3] e^{-j 3\pi/2} \\ &= 1 + 1 \cdot (-j) + 0 \cdot (-1) + 0 \cdot j \\ &= 1 - j \end{aligned}\]

\[\begin{aligned} X_2 &= \sum_{n=0}^{3} x[n] e^{-j 2\pi \frac{2}{4} n}\\ &= x[0] + x[1] e^{-j \pi} + x[2] e^{-j 2\pi} + x[3] e^{-j 3\pi} \\ &= 1 + 1 \cdot (-1) + 0 \cdot 1 + 0 \cdot (-1) \\ &= 0 \end{aligned}\]

\[\begin{aligned} X_3 &= \sum_{n=0}^{3} x[n] e^{-j 2\pi \frac{3}{4} n}\\ &= x[0] + x[1] e^{-j 3\pi/2} + x[2] e^{-j 3\pi} + x[3] e^{-j 9\pi/2}\\ &= 1 + 1 \cdot j + 0 \cdot (-1) + 0 \cdot (-j) \\ &= 1 + j \end{aligned}\]

Note that \(X_3 = X_{3-N} = X_{-1} = X_1^*\), as expected.

Second, we write the signal as a sum of sinusoidal components, using the formula for \(N\) even from the previous exercises: \[x[n] = \frac{1}{N} X_0 + \frac{1}{N} \sum_{k=1}^{N/2-1} 2 |X_k| \cos\left( 2\pi \frac{k}{N} n + \angle{X_k}\right) + \frac{1}{N} |X_{N/2}| \cos\left( \pi n + \angle{X_{N/2}}\right)\]

The modulus and phase of the DFT coefficients are:

  • \(X_0 = 2\): is a real number, positive
    • \(|X_0| = 2\)
    • \(\angle{X_0} = 0\)
  • \(X_1 = 1 - j\):
    • \(|X_1| = \sqrt{1^2 + (-1)^2} = \sqrt{2}\)
    • \(\angle{X_1} = \arctan\left(\frac{-1}{1}\right) = -\frac{\pi}{4}\)
  • \(X_2 = 0\):
    • \(|X_2| = 0\)
    • \(\angle{X_2}\) undefined (doesn’t matter, because the coefficient is 0)
  • \(X_3 = 1 + j\):
    • \(|X_3| = \sqrt{1^2 + 1^2} = \sqrt{2}\)
    • \(\angle{X_3} = \arctan\left(\frac{1}{1}\right) = \frac{\pi}{4}\)

Therefore we can write the signal as: \[\begin{aligned} x[n] &= \frac{1}{4} \cdot 2 + \frac{1}{4} \cdot 2 \sqrt{2} \cos\left( 2\pi \frac{1}{4} n - \frac{\pi}{4}\right)\\ &= \frac{1}{2} + \frac{\sqrt{2}}{2} \cos\left( \frac{\pi}{2} n - \frac{\pi}{4}\right) \end{aligned}\]

The constant DC component is \(\frac{1}{2}\), and there is one sinusoidal component with frequency \(f=\frac{1}{4}\), amplitude \(\frac{\sqrt{2}}{2}\) and initial phase \(-\frac{\pi}{4}\).

7.7 Exercise 7

Write the DFT calculation in Ex.5 as a matrix multiplication.

Solution

This is just a straightforward illustration of the theory.

Note that we can write the calculations for \(X_k\) as the following matrix-vector multiplication: \[\begin{bmatrix} X_0 \\ X_1 \\ X_2 \\ X_3 \end{bmatrix} = \begin{bmatrix} 1 & 1 & 1 & 1 \\ 1 & e^{-j \pi/2} & e^{-j 2\pi/2} & e^{-j 3\pi/2} \\ 1 & e^{-j \pi} & e^{-j 2\pi} & e^{-j 3\pi} \\ 1 & e^{-j 3\pi/2} & e^{-j 6\pi/2} & e^{-j 9\pi/2} \end{bmatrix} \begin{bmatrix} x[0] \\ x[1] \\ x[2] \\ x[3] \end{bmatrix}\]

or, with the values replaced: \[\begin{aligned} \begin{bmatrix} X_0 \\ X_1 \\ X_2 \\ X_3 \end{bmatrix} &= \begin{bmatrix} 1 & 1 & 1 & 1 \\ 1 & -j & -1 & j \\ 1 & -1 & 1 & -1 \\ 1 & j & -1 & -j \end{bmatrix} \begin{bmatrix} 1 \\ 1 \\ 0 \\ 0 \end{bmatrix} \\ &= \begin{bmatrix} 2 \\ 1-j \\ 0 \\ 1+j \end{bmatrix} \end{aligned}\]

Welcome to the world of linear algebra and orthogonal transformations!

7.8 Exercise 8

Compute \(x[n]\) in Ex.4 and Ex.5, in two ways:

  • using the definition formula
  • using the matrix form

Solution

We have to compute the signal \(x[n]\) from the DFT coefficients \(X_k\) that are provided in the exercises.

We can achieve this in many ways:

  1. Since we have \(x[n]\) written as a sum of sinusoids, we can just give values to \(n=0, 1, 2, 3, 4, 5\) and compute the values.
  2. We can use the definition formula of the Inverse DFT, IDFT: \[x[n] = \frac{1}{N} \sum_{k=0}^{N-1} X_k e^{j 2\pi \frac{k}{N} n}\]
  3. We can use the matrix form, which uses the transposed and conjugated matrix of the one used in the DFT calculation:

7.8.0.1 Variant 1: using the sum of sinusoids

We have already written \(x[n]\) as a sum of sinusoids in the previous exercises.

We have to evaluate those expressions for \(n=0, 1, 2, 3, ... , N-1\).

7.8.0.2 Variant 2: using the IDFT formula

The Inverse DFT (IDFT) formula is: \[x[n] = \frac{1}{N} \sum_{k=0}^{N-1} X_k e^{j 2\pi \frac{k}{N} n}, n=0,1,...,N-1\] We have to compute \(N\) sums, each with \(N\) terms.

We will do this only for exercise 4: \[\begin{aligned} x[0] &= \frac{1}{6} \sum(X_0 e^{j 2\pi \frac{0}{6} 0} + X_1 e^{j 2\pi \frac{1}{6} 0} + X_2 e^{j 2\pi \frac{2}{6} 0} + X_3 e^{j 2\pi \frac{3}{6} 0} + X_4 e^{j 2\pi \frac{4}{6} 0} + X_5 e^{j 2\pi \frac{5}{6} 0})\\ &= \frac{1}{6} \sum(X_0 + X_1 + X_2 + X_3 + X_4 + X_5)\\ &= \frac{1}{6} (21 - 3 - 3 - 3 - 3 - 3)\\ &= 1 \end{aligned}\] \[\begin{aligned} x[1] &= \frac{1}{6} \sum(X_0 e^{j 2\pi \frac{0}{6} 1} + X_1 e^{j 2\pi \frac{1}{6} 1} + X_2 e^{j 2\pi \frac{2}{6} 1} + X_3 e^{j 2\pi \frac{3}{6} 1} + X_4 e^{j 2\pi \frac{4}{6} 1} + X_5 e^{j 2\pi \frac{5}{6} 1})\\ &= \frac{1}{6} \sum(X_0 e^{j 0} + X_1 e^{j \pi/3} + X_2 e^{j 2\pi/3} + X_3 e^{j \pi} + X_4 e^{j 4\pi/3} + X_5 e^{j 5\pi/3})\\ &= ... \end{aligned}\] \[\begin{aligned} x[2] &= \frac{1}{6} \sum(X_0 e^{j 2\pi \frac{0}{6} 2} + X_1 e^{j 2\pi \frac{1}{6} 2} + X_2 e^{j 2\pi \frac{2}{6} 2} + X_3 e^{j 2\pi \frac{3}{6} 2} + X_4 e^{j 2\pi \frac{4}{6} 2} + X_5 e^{j 2\pi \frac{5}{6} 2})\\ &= \frac{1}{6} \sum(X_0 e^{j 0} + X_1 e^{j 2\pi/3} + X_2 e^{j 4\pi/3} + X_3 e^{j 2\pi} + X_4 e^{j 8\pi/3} + X_5 e^{j 10\pi/3})\\ &= ... \end{aligned}\] \[\begin{aligned} x[3] &= \frac{1}{6} \sum(X_0 e^{j 2\pi \frac{0}{6} 3} + X_1 e^{j 2\pi \frac{1}{6} 3} + X_2 e^{j 2\pi \frac{2}{6} 3} + X_3 e^{j 2\pi \frac{3}{6} 3} + X_4 e^{j 2\pi \frac{4}{6} 3} + X_5 e^{j 2\pi \frac{5}{6} 3})\\ &= \frac{1}{6} \sum(X_0 e^{j 0} + X_1 e^{j \pi} + X_2 e^{j 2\pi} + X_3 e^{j 3\pi} + X_4 e^{j 4\pi} + X_5 e^{j 5\pi})\\ &= \frac{1}{6} (X_0 - X_1 + X_2 - X_3 + X_4 - X_5)\\ &= 4 \end{aligned}\] \[\begin{aligned} x[4] &= \frac{1}{6} \sum(X_0 e^{j 2\pi \frac{0}{6} 4} + X_1 e^{j 2\pi \frac{1}{6} 4} + X_2 e^{j 2\pi \frac{2}{6} 4} + X_3 e^{j 2\pi \frac{3}{6} 4} + X_4 e^{j 2\pi \frac{4}{6} 4} + X_5 e^{j 2\pi \frac{5}{6} 4})\\ &= \frac{1}{6} \sum(X_0 e^{j 0} + X_1 e^{j 4\pi/3} + X_2 e^{j 8\pi/3} + X_3 e^{j 4\pi} + X_4 e^{j 16\pi/3} + X_5 e^{j 20\pi/3})\\ &= ... \end{aligned}\] \[\begin{aligned} x[5] &= \frac{1}{6} \sum(X_0 e^{j 2\pi \frac{0}{6} 5} + X_1 e^{j 2\pi \frac{1}{6} 5} + X_2 e^{j 2\pi \frac{2}{6} 5} + X_3 e^{j 2\pi \frac{3}{6} 5} + X_4 e^{j 2\pi \frac{4}{6} 5} + X_5 e^{j 2\pi \frac{5}{6} 5})\\ &= \frac{1}{6} \sum(X_0 e^{j 0} + X_1 e^{j 5\pi/3} + X_2 e^{j 10\pi/3} + X_3 e^{j 5\pi} + X_4 e^{j 20\pi/3} + X_5 e^{j 25\pi/3})\\ &= ... \end{aligned}\]

7.8.1 Variant 3: using the matrix form

Note that the preceding calculations can be written as a matrix-vector multiplication:

  • for exercise 4: \[\begin{bmatrix} x[0] \\ x[1] \\ x[2] \\ x[3] \\ x[4] \\ x[5] \end{bmatrix} = \begin{bmatrix} 1 & 1 & 1 & 1 & 1 & 1 \\ 1 & e^{j \pi/6} & e^{j 2\pi/6} & e^{j 3\pi/6} & e^{j 4\pi/6} & e^{j 5\pi/6} \\ 1 & e^{j 2\pi/6} & e^{j 4\pi/6} & e^{j 6\pi/6} & e^{j 8\pi/6} & e^{j 10\pi/6} \\ 1 & e^{j 3\pi/6} & e^{j 6\pi/6} & e^{j 9\pi/6} & e^{j 12\pi/6} & e^{j 15\pi/6} \\ 1 & e^{j 4\pi/6} & e^{j 8\pi/6} & e^{j 12\pi/6} & e^{j 16\pi/6} & e^{j 20\pi/6} \\ 1 & e^{j 5\pi/6} & e^{j 10\pi/6} & e^{j 15\pi/6} & e^{j 20\pi/6} & e^{j 25\pi/6} \end{bmatrix} \begin{bmatrix} X_0 \\ X_1 \\ X_2 \\ X_3 \\ X_4 \\ X_5 \end{bmatrix}\]

The matrix is fixed (depends only on \(N=6\), not on the signal), so the multiplication is straightforward.

We won’t actually compute this, by hand. We could use MATLAB or Python to do it. Note that there is an even faster way to compute this, using the Fast Fourier Transform (FFT) algorithm.

For exercise 5, the matrix is the same, but with \(N=5\), so we have a \(5 \times 5\) matrix. \[\begin{bmatrix} x[0] \\ x[1] \\ x[2] \\ x[3] \\ x[4] \end{bmatrix} = \begin{bmatrix} 1 & 1 & 1 & 1 & 1 \\ 1 & e^{j \pi/5} & e^{j 2\pi/5} & e^{j 3\pi/5} & e^{j 4\pi/5} \\ 1 & e^{j 2\pi/5} & e^{j 4\pi/5} & e^{j 6\pi/5} & e^{j 8\pi/5} \\ 1 & e^{j 3\pi/5} & e^{j 6\pi/5} & e^{j 9\pi/5} & e^{j 12\pi/5} \\ 1 & e^{j 4\pi/5} & e^{j 8\pi/5} & e^{j 12\pi/5} & e^{j 16\pi/5} \end{bmatrix} \begin{bmatrix} X_0 \\ X_1 \\ X_2 \\ X_3 \\ X_4 \end{bmatrix}\]

7.9 Exercise 9

A signal \(x[n]\) has a Z transform with one pole \(p_1 = -0.5\) and one zero \(z_1 = 0.9\). It is known that at \(\omega = \pi\), the modulus of the Fourier transform is \(|X(\omega=\pi)| = 1\).

    1. Find the signal’s Z transform \(X(z)\)
    1. Compute the expression of \(|X(\omega)|\) and \(\angle X(\omega)\)
    1. Find the values \(|X(\frac{\pi}{2})|\), \(|X(\frac{-\pi}{2})|\) and \(|X(0)|\)
    1. Sketch \(|X(\omega)|\)

Solution

a). Find the signal’s Z transform \(X(z)\)

Since there is one zero \(z_1 = 0.9\), the Z transform has one term \((z - 0.9)\) at the numerator.

Since there is one pole \(p_1 = -0.5\), there is a term \((p + 0.5)\) at the denominator.

Therefore, the Z transform looks like this:

\[X(z) = G \frac{z-0.9}{z + 0.5}\]

There is still a scaling factor \(G\) (“gain”) in front which we have to find. The poles and zeros do not tell us anything about the value of the gain factor. This can be found from the additional information that \(|X(\omega=\pi)| = 1\) (in general, from the value of \(X(z)\) or \(X(\omega)\) in one given point).

Indeed, we turn \(X(z)\) into \(X(\omega)\) replacing \(z = e^{j\omega}\):

\[X(\omega) = G \frac{e^{j \omega}-0.9}{e^{j \omega} + 0.5}\]

and for \(\omega = \pi\) we have \(e^{j\pi} = -1\), which means:

\[\begin{aligned} X(\omega = \pi) &= 1 \Leftrightarrow \\ G \frac{-1 - 0.9}{-1 + 0.5} & = 1 \Leftrightarrow \\ G = \frac{0.5}{1.9} \approx 0.278 \end{aligned}\]

Therefore, the Z transform is:

\[X(z) = 0.278 \frac{z-0.9}{z + 0.5}\]

  1. Compute the expression of \(|X(\omega)|\) and \(\angle X(\omega)\)

The Fourier transform \(X(\omega)\) is found by replacing \(z = e^{j \omega}\):

\[X(\omega) = 0.278 \frac{e^{j\omega} - 0.9}{e^{j \omega } + 0.5}\]

To find the modulus and phase of this function, we use the following general rules.

NoteRules for modulus and phase

Given any real or complex values \(a\) and \(b\), the following are true:

  • modulus distributes to multiplication and division:

\[\begin{aligned} |a \cdot b | &= |a| \cdot |b| \\ |\frac{a}{b} | &= \frac{|a|}{|b|} \\ \end{aligned}\]

  • phase transforms product and division into sum and difference:

\[\begin{aligned} \angle{a \cdot b } &= \angle{a} + \angle{b} \\ \angle{\frac{a}{b}} &= \angle{a} - \angle{b} \\ \end{aligned}\]

Therefore, in our case we have the modulus: \[\begin{aligned} |X(\omega)| &= |0.278| \cdot \frac{|e^{j\omega} - 0.9|}{|e^{j \omega } + 0.5|} \\ &= 0.278 \cdot \frac{| \cos(\omega) + j\sin(\omega) - 0.9|}{|\cos(\omega) + j\sin(\omega) +0.5|} \\ &= 0.278 \cdot \frac{\sqrt{ (\cos(\omega) - 0.9)^2 + \sin^2(\omega) }}{\sqrt{ (\cos(\omega) + 0.5)^2 + \sin^2(\omega) }} \end{aligned}\]

and the phase:

\[\begin{aligned} \angle{X(\omega)} &= \angle{0.278} + \angle{(e^{j\omega} - 0.9)} - \angle{(e^{j \omega } + 0.5)} \\ &= \angle{0.278} + \angle{(\cos(\omega) + j\sin(\omega) - 0.9)} - \angle{(\cos(\omega) + j\sin(\omega) + 0.5)} \\ &= 0 + \arctan{\frac{\sin(\omega)}{\cos(\omega) - 0.9}} - \arctan{\frac{\sin(\omega)}{\cos(\omega) + 0.5}} \end{aligned}\]

These two expressions may look complicated, and indeed they are, but they are useful. For example, we can now plot them, and take a look at the Fourier transform:

Code
w = np.linspace(-np.pi, np.pi, 1000)

X_mod = 0.278 * np.sqrt((np.cos(w) - 0.9)**2 + np.sin(w)**2) / np.sqrt((np.cos(w) + 0.5)**2 + np.sin(w)**2)
X_phase = np.arctan2(np.sin(w), np.cos(w) - 0.9) - np.arctan2(np.sin(w), np.cos(w) + 0.5)

pi_ticks = [-np.pi, -np.pi/2, 0, np.pi/2, np.pi]
pi_ticklabels = [r'$-\pi$', r'$-\frac{\pi}{2}$', r'$0$', r'$\frac{\pi}{2}$', r'$\pi$']

plt.figure(figsize=(6, 2))
plt.plot(w, X_mod)
plt.xticks(pi_ticks, pi_ticklabels)
plt.xlabel(r'$\omega$')
plt.ylabel(r'$|X(\omega)|$')
plt.title(r'Modulus $|X(\omega)|$ for $X(z)=0.278\frac{z-0.9}{z+0.5}$')
plt.tight_layout()

plt.figure(figsize=(6, 2))
plt.plot(w, X_phase)
plt.xticks(pi_ticks, pi_ticklabels)
plt.yticks(pi_ticks, pi_ticklabels)
plt.xlabel(r'$\omega$')
plt.ylabel(r'$\angle X(\omega)$')
plt.title(r'Phase $\angle X(\omega)$ for $X(z)=0.278\frac{z-0.9}{z+0.5}$')
plt.tight_layout()

c). Find the values \(|X(\frac{\pi}{2})|\), \(|X(\frac{-\pi}{2})|\) and \(|X(0)|\)

We just have to give values to \(\omega\) in the expressions above.

For \(\omega=\frac{\pi}{2}\), we know \(\cos(\frac{\pi}{2}) = 0\), \(\sin(\frac{\pi}{2}) = 1\), and thus:

\[\begin{aligned} |X(\frac{\pi}{2})| &= 0.278 \cdot \frac{\sqrt{ (0 - 0.9)^2 + 1^2 }}{\sqrt{ (0 + 0.5)^2 + 1^2 }} \\ &= 0.278 \cdot \frac{\sqrt{1.81}}{\sqrt{ 1.25 }} \end{aligned}\]

For \(\omega=-\frac{\pi}{2}\), we know \(\cos(-\frac{\pi}{2}) = 0\), \(\sin(-\frac{\pi}{2}) = -1\), and thus:

\[\begin{aligned} |X(-\frac{\pi}{2})| &= 0.278 \cdot \frac{\sqrt{ (0 - 0.9)^2 + 1^2 }}{\sqrt{ (0 + 0.5)^2 + 1^2 }} \\ &= 0.278 \cdot \frac{\sqrt{1.81}}{\sqrt{ 1.25 }} \end{aligned}\] (same value, since the modulus of the Fourier transform is even)

For \(\omega=0\), we know \(\cos(0) = 1\), \(\sin(0) = 0\), and thus:

\[\begin{aligned} |X(0)| &= 0.278 \cdot \frac{\sqrt{ (1 - 0.9)^2 + 0^2 }}{\sqrt{ (1 + 0.5)^2 + 0^2 }} \\ &= 0.278 \cdot \frac{0.1}{1.5} \end{aligned}\]

7.9.0.1 Variant: using geometrical method

We could also have found the same values using the geometrical method.

For \[X(z) = 0.278 \frac{z-0.9}{z+0.5}\] we have one zero at \(z_1=0.9\) and one pole at \(p_1=-0.5\).

Code
fig, ax = plt.subplots(figsize=(4.2, 4.2))

theta = np.linspace(0, 2*np.pi, 600)
ax.plot(np.cos(theta), np.sin(theta), 'k--', lw=1, label='unit circle')
ax.axhline(0, color='0.7', lw=0.8)
ax.axvline(0, color='0.7', lw=0.8)

# Zero and pole
ax.plot(0.9, 0, 'ob', ms=8, mfc='none', mew=2, label='zero z=0.9')
ax.plot(-0.5, 0, 'xr', ms=9, mew=2, label='pole p=-0.5')

# Points on unit circle for omega = 0, +/- pi/2
pts = [1+0j, 1j, -1j]
labels = [r'$\omega=0$', r'$\omega=\frac{\pi}{2}$', r'$\omega=-\frac{\pi}{2}$']
for p, lab in zip(pts, labels):
    ax.plot(np.real(p), np.imag(p), 'ko', ms=4)
    ax.text(np.real(p) + 0.05, np.imag(p) + 0.05, lab, fontsize=9)
    ax.plot([0.9, np.real(p)], [0, np.imag(p)], color='tab:blue', lw=1, alpha=0.8)
    ax.plot([-0.5, np.real(p)], [0, np.imag(p)], color='tab:red', lw=1, alpha=0.8)
    d2_zero = (np.real(p) - 0.9)**2 + (np.imag(p))**2
    d2_pole = (np.real(p) + 0.5)**2 + (np.imag(p))**2
    mid_zero_x, mid_zero_y = (0.9 + np.real(p)) / 2, np.imag(p) / 2
    mid_pole_x, mid_pole_y = (-0.5 + np.real(p)) / 2, np.imag(p) / 2
    ax.text(mid_zero_x + 0.03, mid_zero_y + 0.03, rf'$\sqrt{{{d2_zero:.2f}}}$', color='tab:blue', fontsize=8)
    ax.text(mid_pole_x + 0.03, mid_pole_y - 0.06, rf'$\sqrt{{{d2_pole:.2f}}}$', color='tab:red', fontsize=8)

ax.set_aspect('equal', adjustable='box')
ax.set_xlim(-1.3, 1.3)
ax.set_ylim(-1.3, 1.3)
ax.set_xlabel(r'$\Re\{z\}$')
ax.set_ylabel(r'$\Im\{z\}$')
ax.set_title('Pole-zero plot and geometric distances')
ax.legend(loc='upper left', fontsize=8)
plt.tight_layout()

At a given frequency \(\omega\), the point \(e^{j\omega}\) is on the unit circle and:

  • \(|e^{j\omega}-0.9|\) is the distance to the zero
  • \(|e^{j\omega}+0.5|\) is the distance to the pole
  • \(|X(\omega)| = 0.278 \frac{|e^{j\omega}-0.9|}{|e^{j\omega}+0.5|}\)

So: \[\begin{aligned} |X(\tfrac{\pi}{2})| &= 0.278 \cdot \frac{\sqrt{1.81}}{\sqrt{1.25}} \approx 0.334 \\ |X(-\tfrac{\pi}{2})| &= 0.278 \cdot \frac{\sqrt{1.81}}{\sqrt{1.25}} \approx 0.334 \\ |X(0)| &= 0.278 \cdot \frac{0.1}{1.5} \approx 0.0185 \end{aligned}\]

d). Sketch \(|X(\omega)|\)

Using the same geometric idea:

  • near \(\omega=0\), the unit-circle point is close to the zero at \(z=0.9\), so \(|X(\omega)|\) is very small
  • near \(\omega=\pi\), the unit-circle point is closer to the pole at \(z=-0.5\), so \(|X(\omega)|\) is large
  • the response is even in \(\omega\), so the left and right halves are symmetric

Therefore, the sketch has a deep minimum around \(\omega=0\) and a broad maximum around \(\omega=\pm \pi\).

Code
w_sketch = np.linspace(-np.pi, np.pi, 600)
X_mod_sketch = 0.278 * np.sqrt((np.cos(w_sketch) - 0.9)**2 + np.sin(w_sketch)**2) / np.sqrt((np.cos(w_sketch) + 0.5)**2 + np.sin(w_sketch)**2)

plt.figure(figsize=(5, 1.8))
plt.plot(w_sketch, X_mod_sketch, color='tab:blue', lw=2)
plt.xticks(
    [-np.pi, -np.pi/2, 0, np.pi/2, np.pi],
    [r'$-\pi$', r'$-\frac{\pi}{2}$', r'$0$', r'$\frac{\pi}{2}$', r'$\pi$']
)
plt.xlabel(r'$\omega$')
plt.ylabel(r'$|X(\omega)|$')
plt.title(r'Sketch of $|X(\omega)|$')
plt.grid(alpha=0.25)
plt.tight_layout()

7.10 Exercise 10

Design the pole-zero plot of a signal with:

a). low frequency content b). frequency content around the frequency \(\omega = \frac{\pi}{2}\)

Solution

a). Signal with low-frequency content

We consider the following pole-zero plot. The pole is close to the point \(1\), but not quite on the unit circle (for stability reasons), e.g. \(p = 0.9\). The zero is precisely on the unit circle, at point \(-1\).

Code
pa = [0.9]   # one pole near z=1
za = [-1]    # one zero at z=-1

fig, ax = plt.subplots(figsize=(4.3, 4.1))
t = np.linspace(0, 2*np.pi, 500)
ax.plot(np.cos(t), np.sin(t), 'k--', lw=1, label='unit circle')
ax.axhline(0, color='0.75', lw=0.8)
ax.axvline(0, color='0.75', lw=0.8)
ax.plot(np.real(za), np.imag(za), 'ob', ms=8, mfc='none', mew=2, label='zero at -1')
ax.plot(np.real(pa), np.imag(pa), 'xr', ms=9, mew=2, label='pole at 0.9')
ax.set_aspect('equal', adjustable='box')
ax.set_xlim(-1.25, 1.25)
ax.set_ylim(-1.25, 1.25)
ax.set_xlabel(r'$\Re\{z\}$')
ax.set_ylabel(r'$\Im\{z\}$')
ax.set_title(r'a) Pole-zero plot (low-frequency design)')
ax.legend(loc='upper right', fontsize=8)
plt.tight_layout()

Interpretation of the pole-zero plot using the geometrical method:

  • near \(\omega \approx 0\), the point \(e^{j\omega}\) is close to the pole at \(0.9\), so denominator distance is small and \(|X_a(\omega)|\) is large
  • near \(\omega \approx \pi\), the point \(e^{j\omega}\) is close to the zero at \(-1\), so numerator distance is small and \(|X_a(\omega)|\) is small
  • exactly at \(\omega = \pi\), the point \(e^{j\omega}\) is exactly in the zero at \(-1\), so numerator is \(0\) and \(|X_a(\omega)| = 0\)

So the Fourier transform is dominated by low frequencies.

The sketch of the Fourier transform magnitude obtained in this way shows it is low frequency:

Code
w = np.linspace(-np.pi, np.pi, 1200)
Xa = (np.exp(1j*w) + 1) / (np.exp(1j*w) - 0.9)

plt.figure(figsize=(6.2, 2.1))
plt.plot(w, np.abs(Xa), color='tab:blue', lw=2)
plt.xticks(
    [-np.pi, -np.pi/2, 0, np.pi/2, np.pi],
    [r'$-\pi$', r'$-\frac{\pi}{2}$', r'$0$', r'$\frac{\pi}{2}$', r'$\pi$']
)
plt.xlabel(r'$\omega$')
plt.ylabel(r'$|X_a(\omega)|$')
plt.title(r'a) Sketch of Fourier magnitude')
plt.grid(alpha=0.25)
plt.tight_layout()

From this pole-zero plot we deduce:

\[ X_a(z) = C_a \cdot \frac{z+1}{z-0.9} \]

and, on the unit circle (\(z=e^{j\omega}\)):

\[ X_a(\omega) = C_a \cdot \frac{e^{j\omega}+1}{e^{j\omega}-0.9} \]

b). Signal with frequency content around \(\omega = \frac{\pi}{2}\)

We consider the following pole-zero plot. The poles are selected close to the unit circle, but not quite on it (for stability), e.g. \(p_{1,2} = \pm j 0.95\). The zeros are precisely in the values \(1\) and \(-1\).

Code
r = 0.92
pb = [1j*r, -1j*r]  # conjugate pole pair near omega = +/- pi/2
zb = [1, -1]        # two zeros at z=1 and z=-1

fig, ax = plt.subplots(figsize=(4.3, 4.1))
t = np.linspace(0, 2*np.pi, 500)
ax.plot(np.cos(t), np.sin(t), 'k--', lw=1, label='unit circle')
ax.axhline(0, color='0.75', lw=0.8)
ax.axvline(0, color='0.75', lw=0.8)
ax.plot(np.real(zb), np.imag(zb), 'ob', ms=8, mfc='none', mew=2, label='zeros at ±1')
ax.plot(np.real(pb), np.imag(pb), 'xr', ms=9, mew=2, label=r'poles $\pm j0.92$')
ax.set_aspect('equal', adjustable='box')
ax.set_xlim(-1.25, 1.25)
ax.set_ylim(-1.25, 1.25)
ax.set_xlabel(r'$\Re\{z\}$')
ax.set_ylabel(r'$\Im\{z\}$')
ax.set_title(r'b) Pole-zero plot ($\omega\approx\pi/2$ design)')
ax.legend(loc='upper right', fontsize=8)
plt.tight_layout()

Interpretation of the pole-zero plot using the geometrical method:

  • near \(\omega \approx \frac{\pi}{2}\) and \(-\frac{\pi}{2}\), \(e^{j\omega}\) is close to poles, so denominator distances are small and \(|X_b(\omega)|\) is large
  • near \(\omega \approx 0\) and \(\omega \approx \pi\), \(e^{j\omega}\) is close to zeros at \(1\) and \(-1\), so numerator distances are small and \(|X_b(\omega)|\) is small
  • precisely at \(\omega = 0\) and \(\omega = \pi\), \(e^{j\omega}\) is exactly in the zeros at \(1\) and \(-1\), so numerator distances are zero and \(|X_b(\omega)| = 0\)

So the Fourier transform has strong content around \(\omega=\pm\frac{\pi}{2}\) and attenuation around \(\omega=0,\pi\).

Sketch of the Fourier transform magnitude:

Code
w = np.linspace(-np.pi, np.pi, 1200)
Xb = ((np.exp(1j*w) - zb[0]) * (np.exp(1j*w) - zb[1])) / ((np.exp(1j*w) - pb[0]) * (np.exp(1j*w) - pb[1]))

plt.figure(figsize=(6.2, 2.1))
plt.plot(w, np.abs(Xb), color='tab:blue', lw=2)
plt.xticks(
    [-np.pi, -np.pi/2, 0, np.pi/2, np.pi],
    [r'$-\pi$', r'$-\frac{\pi}{2}$', r'$0$', r'$\frac{\pi}{2}$', r'$\pi$']
)
plt.xlabel(r'$\omega$')
plt.ylabel(r'$|X_b(\omega)|$')
plt.title(r'b) Sketch of Fourier magnitude')
plt.grid(alpha=0.25)
plt.tight_layout()

From this pole-zero plot we deduce:

\[ X_b(z) = C_b \cdot \frac{(z-1)(z+1)}{(z-j0.92)(z+j0.92)} = C_b \cdot \frac{z^2-1}{z^2+0.92^2} \]

and, on the unit circle (\(z=e^{j\omega}\)):

\[ X_b(\omega) = C_b \cdot \frac{(e^{j\omega}-1)(e^{j\omega}+1)} {(e^{j\omega}-j0.92)(e^{j\omega}+j0.92)} \]