The complex exponential signal#
As we explained in Chapter 2, the exponential function,
Continuous time complex exponential signal#
Consider the continuous time exponential signal
Note that
Let us examine its behavior. We will focus only on the real part for ease of visualization but the imaginary part behaves similarly.
import sympy as sym
t = sym.symbols('t', real=True)
# the signal cos(omega t) for different omega values:
x = sym.cos(t)
y = sym.cos(2*t)
z = sym.cos(0.5*t)
# plot
px = sym.plot(x, (t, -5, 5), legend=True, label='$cos(t)$', show=False);
py = sym.plot(y, (t, -5, 5), legend=True, label=r'cos(2t)$', show=False,
line_color='orange')
pz = sym.plot(z, (t, -5, 5), legend=True, label=r'$cost(0.5t)$', show=False,
line_color='green')
py.extend(px)
pz.extend(py)
pz.show()

If you run the code below, it will create a slider using which you can change the value of omega using your mouse. It facilitates seeing how the plot changes with different values of omega.
import matplotlib.pyplot as plt
import numpy as np
from ipywidgets import interact
# continuous time signal
def plot_cos(omega):
t = np.arange(0,4*np.pi, .001)
x = np.cos(omega*t)
plt.plot(t,x)
plt.xlabel('t')
plt.ylabel('cos($\omega$ t)')
plt.show()
interact(plot_cos, omega=(0,10,.1));
Discrete time complex exponential signal#
As we mentioned above, the CT exponential signal
However, for the DT signal
Using the Euler’s formula, we can write
Now let us focus on the real part of
Then, we can write the condition for
In summary, the frequency of
Now let us inspect whether
import numpy as np
import matplotlib.pyplot as plt
n = np.arange(-20, 20, 1)
# the signal cos(omega n)
omega = 1
x = np.cos(omega*n)
# plot
plt.stem(n,x, linefmt='blue');

While the plot shows a roughly repeating pattern, it is not possible to draw a certain conclusion from the plot. We should check the condition
When
Let us now inspect
# the signal cos(omega n)
omega = np.pi/8
x = np.cos(omega*n)
# plot
plt.stem(n,x, linefmt='blue');

This time the plots looks periodic but again, we should the check periodicity condition:
The following piece of code will let you change omega interactively (through a slider). Observe the behavior of the signal and compare it to that of the CT counterpart above. (Hint: clicking on the slider and then using the arrow keys on your keyboard allows minimal increments for omega.)
# discrete time signal
def plot_cos(omega):
n = np.arange(-20,20, 1)
x = np.cos(omega*n)
plt.stem(n,x);
plt.xlabel('n')
plt.ylabel('cos($\omega$ n)')
plt.show()
interact(plot_cos, omega=(0,100,.01));