Unit 1: Introducing Digital Signal Processing#
Colophon#
An annotatable copy of the notes for this presentation is available as Worksheet 1.
The Jupytext source code for this page is introduction/index.md.
You can view the notes for this presentation as a webpage (HTML).
This page is downloadable as a PDF file.
Signals and Systems for Dummies#
Signals and Systems for Dummies (SS4D) [Wickert, 2013] provides a useful introduction to the topics that will be covered in this module and it is in the Reading List as a recommended text. I have based this presentation on Chapter 1 which is available as a downloadable PDF from the publishers.
You should read Chapter 1 of SS4D in conjunction with the notes for this presentation.
Note that Signals and Systems for Dummies is available as an e-book from the University Library.
Topics#
Continuous-time signals#
Continuous signals are represented mathematically by functions which vary continuously with time.
Sinusoidal signals (e.g. AC) are pretty fundamental in electrical engineering. The mathematical model of a sinusoidal signal is:
Exercise#
First attempt#
For this expression, we wish to match each of the symbols to its definition.
Without computing anything, see if you can complete this table.
Symbol |
Definition |
---|---|
Frequency in rad/s |
|
Amplitude |
|
Frequency in Hz |
|
Phase in radians |
Gaining insight using computers#
To help us answer these questions, let’s use our Mathematical tools to plot a signal like this and explore it. The example we will use is from Signals and Systems for Dummies (SS4D: page 12):
Wolfram Alpha#
Here’s the link: https://www.wolframalpha.com
Paste this into the search box
plot 3 cos(2 pi 2 t - 3 pi/4)
Try changing the numbers to gain insight.
MATLAB#
In MATLAB we would need to tackle this by breaking down the steps.
% Make sure that we have a clean workspace
clear all
format compact
setappdata(0, "MKernel_plot_format", 'svg')
Define t
t = linspace(0, 1, 100);
Define x
x = 3 * cos(2*pi*2*t - 3*pi/4);
Plot result and label plot
plot(t,x)
title('A Sinusoidal Signal')
xlabel('Time t (s)')
ylabel('Amplitude')
grid
If you want to execute this in MATLAB, you can create a file by copying this text into an m-file
called sinewave.m
:
% SINEWAVE - plot function $x(t) = 3 \cos(2\pi t - 3 \pi/4)$ for $t = 0\ldots 1$
%% Set up the problem
% define t
t = linspace(0, 1, 100);
% define x
x = 3 * cos(2*pi*2*t - 3*pi/4);
%% Plot result and label plot
plot(t,x)
title('A Sinusoidal Signal')
xlabel('Time t (s)')
ylabel('Amplitude')
grid
To run this script, just type the filename without the .m extension.
sinewave

(Download sinewave.m)
To run this script, just type the filename without the .m
extension. Try adjusting the values of the numerical constants and see what insights you gain.
Returning to the Question#
Sinusoidal signals (e.g. AC) are pretty fundamental in electrical engineering. The mathematical model of a sinusoidal signal is:
Exercise – second go after gaining insight from your computer#
Using the insight just gained by exploring this function with a computer, match each of the symbols to its definition again.
Symbol |
Definition |
---|---|
Phase in radians |
|
Frequency in Hz |
|
Amplitude |
|
Frequency in rad/s |
Did you get different answers?
Supplementary question#
What is the period of the waveform in seconds?
Notes
In communications and electronic signal processing, the frequency of sinusoidal signals us usually given in cycles per second or Hz.
In mathematics, the frequency is always expressed in radians per second.
In some courses, including later in this one and in EG-243 Control Systems, the frequency
is often called the natural frequency and is usually written .
Try This Yourself#
Use any or all of computing tools that you have access to to explore other sinusoids. Change the values of the variables and explain what happens.
Try adding sinusoids of different amplitudes and different frequencies together and see what happens.
Change
cos
tosin
and see what happens.
Continuous-time Systems#
Systems operate on signals. In mathematical terms, a system is a function or an operator,
Mathematically we would write this:
Example 1#
An example of a continuous-time system is an electronic amplifier with a gain of 5 and level shift of 2:
In this course, we will model such systems as block diagram models in Simulink.
Block diagram model in Simulink#
The Similink code can be downloaded from this file gain_level_shift.slx.
Discrete-time Signals#
Discrete-time signals are a function of a time index
Example 2#
Consider the following simple signal, a pulse sequence:
We can plot this in MATLAB as a stem plot
Procedure#
Define function using this text:
% Define the function
function [ y ] = x( n )
if n < 0 | n >= 10
y = 0;
else
y = 5;
end
end
Save as y.m
%% Define sample points
n = -15:18;
%% Make space for the signal
xn = zeros(size(n));
%% Define sample points
n = -15:18;
%% Make space for the signal
xn = zeros(size(n));
%% Compute the signal x[n]
for i = 1:length(xn)
xn(i) = y(n(i));
end
%% Plot the result
stem(n,xn)
axis([-15, 18, 0, 6])
title('Stem Plot for a Discrete Signal')
xlabel('Sample n')
ylabel('Signal x[n]')
grid

Discrete-time Systems#
A discrete-time system, like its continuous-time counterpart, is a function,
The term tap denotes that output at time instant
This system is available as a Simulink model discrete_system.slx
In words, this system scales the present input by 3/4 and adds it to the past value of the input scaled by 1/4. The notion of the past input comes about because
Signal Classifications#
Periodic#
Signals that repeat over and over are said to be periodic. In mathematical terms, a signal is periodic if:
Continuous signal
Discrete signal
The smallest
The sinusoidal signal we saw earlier is periodic because of the
Square Wave#
This code generates a square wave.
%% A Periodic signal (square wave)
t = linspace(0, 1, 500);
x = square(2 * pi * 5 * t);
This Square wave is a 5 Hz waveform sampled at 500 Hz for 1 second
plot(t, x);
ylim([-2, 2]);
grid()
title('A Periodic Signal')
xlabel('Time t (s)')
ylabel('Amplitude')

What is the period
Aperiodic#
Signals that are deterministic (completely determined functions of time) but not periodic are known as aperiodic. Point of view matters. If a signal occurs infrequently, you may view it as aperiodic.
This is how we generate an aperiodic rectangular pulse of duration
%% An aperiodic function
tau = 1;
x = linspace(-1,5,1000);
y = rectangularPulse(0,tau,x);
plot(x,y)
ylim([-0.2,1.2])
grid
title('An Aperiodic Signal')
xlabel('Time t (s)')
ylabel('Amplitude')

Random#
A signal is random if one or more signal attributes takes on unpredictable values in a probability sense.
Engineers working with communication receivers are concerned with random signals, especially noise.
%% Plot a Random Signal
plot(0.5 + 0.25 * rand(100,1))
ylim([0,1])
grid
title('Random Signal')
xlabel('Time t (s)')
ylabel('Amplitude')

Domains for Signals and Systems#
Most of the signals we encounter on a daily basis reside in the time domain. They’re functions of independent variable
Other Domains you will encounter#
The most commonly used domains used when analyzing continuous-time signals are the frequency domain (
Similarly, for discrete-time signals, you may need to transform from the discrete-time domain (
This section briefly introduces the world of signals and systems in the frequency, s-, and z-domains. More on these domains will follow.
Systems, continuous and discrete, can also be transformed to the frequency and s- and z-domains, respectively. Signals can, in fact, be passed through systems in these alternative domains. When a signal is passed through a system in the frequency domain, for example, the frequency domain output signal can later be returned to the time domain and appear just as if the time-domain version of the system operated on the signal in the time domain.
Consider the sum of a two-sinusoids signal
This can be coded as
% TWO_SINES - plot two sinusoids signal
A1 = 2; f1 = 1;
A2 = 1.5;f2 = 2.2;
t = linspace(0, 3*(1/f1), 1000);
s1 = A1*cos(2*pi*f1*t);
s2 = A2*cos(2*pi*f2*t);
subplot(4,1,1)
plot(t,s1),ylim([-5,5]),xlabel('Time t (s) '),ylabel('s1')
subplot(4,1,2)
plot(t,s2),ylim([-5,5]),xlabel('Time t (s) '),ylabel('s2')
subplot(4,1,3)
plot(t,s1+s2),ylim([-5,5]),xlabel('Time t (s) '),ylabel('x(t) = s2 + s2')
subplot(4,1,4)
axis([0,4,0,2.5])
arrow([f1,0],[f1,A1]),text(f1,A1+0.2,'A1'),text(f1+0.05,0.2,'f1')
arrow([f2,0],[f2,A2]),text(f2,A2+0.2,'A2'),text(f2+0.05,0.2,'f2')
ylabel('Frequency Spectrum X(f)'),xlabel('Frequency (Hz)')
Save this as two_sines.m
Run
two_sines

(Download two_sines.m)
Viewing Signals in the Frequency Domain#
The top waveform plot, denoted
Think about tuning in a radio station. Stations are located at different center frequencies. The stations don’t interfere with one another because they’re separated from each other in the frequency domain. In the frequency spectrum plot, imagine that
Fourier Transform#
We use the Fourier transform to move away from the time domain and into the frequency domain. To get back to the time domain, use the inverse Fourier transform. We will find out more about these transforms in this module.
Laplace and Z-Transform Domains#
From the time domain to the frequency domain, only one independent variable,
In addition to visualization properties, the s-domain reduces differential equation solving to algebraic manipulation. For discrete-time signals, the z-transform accomplishes the same thing, except differential equations are replaced by difference equations.
Systems Thinking and Systems Design#
See section Testing Product Concepts with Behavioral Level Modeling from Chapter 1 of SS4D ([Wickert, 2013] pages 18–20) and add some notes to summarize this for yourself.
We will use behavioural modelling
We will rely on abstraction
We work top-down
We make use of mathematics and mathematical software.
Familiar Signals and Systems#
See pages 21-23 of the free sample (Chapter 1) of [Wickert, 2013] for notes and details.