A Unit Impulse Signal

Explore how a unit impulse signal forms the fundamental unit of discrete-time signals.

No computer can plot a continuous-time sine wave. When we see such a figure on our screen, it’s in fact an interpolated version of a discrete-time sine wave in which the samples are joined together with straight lines.

A discrete-time sinusoid

To understand this idea, let’s generate another sinusoid but with a low sample rate. Here, we don’t join the individual samples to display the discrete-time signals, as shown below:

Press + to interact
A discrete-time sinusoid
A discrete-time sinusoid

Let’s run some code and observe the effect on this discrete-time signal.

Press + to interact
import numpy as np
import matplotlib.pyplot as pl
figWidth = 20
figHeight = 10
# Generating a cosine
fs = 10 # sample rate
Ts = 1/fs # sample time
f = 1
T = 1/f
A = 1
phi = 0
t = np.arange(0, 2*T, Ts)
s = A*np.cos(2*np.pi*f*t + phi)
# Plotting the signal
fig, ax = pl.subplots(figsize=(figWidth, figHeight))
ax.vlines(t, ymin=s, ymax=0, color='g', linewidth=2, zorder=10, clip_on=False)
ax.plot(t, s, 'o', color='orange', markersize=10, zorder=10, clip_on=False)
# Axes lines
ax.axhline(y=0, color='k', linewidth=2)
ax.axvline(x=0, color='k', linewidth=2)
ax.set_xlim(-Ts, 2*T+Ts)
ax.set_xticks(np.linspace(0, 2*T-2*Ts, 7))
ax.set_xticklabels(np.arange(0, 21, 3))
ax.set_ylim(-1.1, 1.1)
ax.set_yticks(np.linspace(-1, 1, 5))
ax.tick_params(labelsize=18)
# Hide the right and top spines
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
ax.set_title("A Discrete-Time Sinusoid", fontsize=18)
ax.set_xlabel("$n$", fontsize=18)
ax.set_ylabel("$x[n]$", fontsize=18)
ax.grid()
# saving figure
pl.savefig('output/cosine-discrete.png')

As we can see, all discrete-time signals are constructed from individual samples.

A time-domain impulse

For this reason, a unit impulse δ[n]\delta [n] ...