Chapter 2 DSP Basics

In this part of the course, we will cover the basic aspects of signal processing. Although some of you may already be familiar with some topics, this revision will reinforce these to make you more comfortable.

2.1 Why DSP?

The use of digital signal processing caught on initially with the development of computers and microprocessors that could perform computations effectively and quickly. Over the past decades, the transition to digital media has been very fast. As an example, the gramophone and audio casettes made way for compact discs, which are fully digital media. Similarly, film cameras have now made way for completely digital and compact cameras.

The reasons for these shifts are many. For one, computations based on numbers is repeatable and reliable, unlike some analog computations that may be susceptible to noise. In addition, recent developments in processor speeds and efficiencies have made real-time signal processing possible, which is why compact devices like smartphones are able to perform advanced signal and image processing.

In general, the basic concepts involved in both analog and digital signal processing are quite similar. The key advantage of using digital signal processing is that the processing operation that is performed (such as filtering, estimation, inference etc.) is converted to a numerical computation problem that can be solved in a computer, rather than one that needs analog components for solving it.

More details are available in the textbook, as well as various sources on the internet.

2.2 “Digital” vs. “Discrete-time”

One detail that you may have noticed, especially if you see the title of the textbook, is the distinction between “digital” and just “discrete-time”. Typically, the digital term refers to whole numbers, or digits, such as natural numbers. In the signal processing domain, this typically means that the values of the signal a quantized to be one of a limited set of values. For example, an 8-bit quantized signal takes only one of 256 values, such as -128 to 127. The problem with this quantization is that this can change the properties of the signal in subtle ways that are not immediately apparent. We will consider this in the later chapters.

To get an idea of how quantization affects the signal, shown below is an example of what happens when the original signal (black dots) is quantized to integer values (blue dots). Naturally, this means that the processing occurs on a different signal. This may be a good enough approximation for the application, but can sometimes lead to inaccuracies that are unacceptable.

The blue dots represent the quantized version of the original signal (black dots)

Figure 2.1: The blue dots represent the quantized version of the original signal (black dots)

For the current discussion, we will assume that the values that signals can take are real (or complex) values without any quantization effects. In this case, to emphasize that only the time aspect is discretized, we can refer to this as discrete-time signals. However, for convenience and ease of expression, we will just use the terms digital and discrete-time interchangeably unless otherwise needed.

2.3 Representation of digital signals

A digital signal is a sequence, typically indexed by a discrete set. Most commonly, a signal is a set of real (or complex) values that can be expressed

2.4 Examples of common digital signals

We now cover some sample digital signals. First, the standard unit impulse, represented as \(\delta[n]\):

import plot_helper
import pylab as p
N = 5
n = p.r_[-N:N+1]
x = p.zeros(n.shape)
x[N] = 1.0
plot_helper.stemplot(n, x, title=r'$x[n] = \delta[n]$', filename='delta.svg')
The discrete-time unit impulse sequence

Figure 2.2: The discrete-time unit impulse sequence

The unit impulse is commonly used as an ingredient to represent other signals, since we rely on the concept that all digital signals can be represented as scaled and shifted versions of these impulses.

The next interesting function is the unit step function \(u[n]\).

import plot_helper
import pylab as p
N = 7
n = p.r_[-N:N+1]
x = p.zeros(n.shape)
x[N:] = 1.0
plot_helper.stemplot(n, x, title=r'$x[n] = u[n]$', filename='unitstep.svg')
The discrete-time unit step sequence

Figure 2.3: The discrete-time unit step sequence

As we will see in the following sections, the unit step can be viewed as representing a system that works as an “accumulator”. In addition, \(u[n]\) and \(\delta[n]\) are related as follows:

\[ u[n] = \sum_{k = -\infty}^n \delta[n - k] \]

As an exercise, try to find out how to use the unit step to construct rectangular windows, i.e., signals like

\[ w[n] = \begin{cases} 1 &\mbox{if } n \in \{0, 1, 2, \ldots N-1\} \\ 0 & \mbox{otherwise}\end{cases} \]

Our next example is the causal exponential sequence \(a^n u[n]\). For this, we note that whether \(|a|\) is larger than \(1\) or smaller determines the nature of the sequence. For \(|a| > 1\), the exponential grows, while for \(|a| < 1\), it decays. Shown below is the decaying exponential \((0.9)^n u[n]\).

import plot_helper
import numpy as np
N = 2
n = np.arange(-N, 10)
x = np.power(0.9, n)
x[:N] = 0.0
plot_helper.stemplot(n, x, title=r'$x[n] = (0.9)^n u[n]$', filename='an_un.svg')
A discrete-time exponential sequence.

Figure 2.4: A discrete-time exponential sequence.

As a final example, we present the (maybe “periodic”) discrete-time sinusoid \(\cos \omega_0 n\), where \(-\pi < \omega_0 \leq \pi\). Note that we have put periodic in quotes, since this sequence is not necessarily periodic for all values of \(\omega_0\). As an example,

import plot_helper
import numpy as np
n = np.arange(-7, 7)
omega_0 = 2 * np.pi / 10
x = np.cos(omega_0 * n)
plot_helper.stemplot(n, x, title=r'$x[n] = \cos(2\pi n/10)$', filename='cos_omega0.svg')
The discrete-time sinusoid $\cos \omega_0  n$.

Figure 2.5: The discrete-time sinusoid \(\cos \omega_0 n\).

Can you provide values of \(\omega_0\) for which \(\cos \omega_0 n\) is not periodic?