ECE 1010 ECE Problem Solving I
Signal Processing
10
Introduction
One of the premiere uses of MATLAB is in the analysis of signal
processing and control systems. In this chapter we consider signal processing. The final chapter of the text considers control
systems. To efficiently support signal processing and control system problem solving in MATLAB requires the Signal Processing
Toolbox and Control System Toolbox respectively. The student
edition of MATLAB 5.0 fully supports both of these toolboxes.
Two forms of signal processing are:
• Analog or continuous-time signal processing (ASP), using
analog electronic circuits
• Digital signal processing (DSP), using discrete-time algorithms running on computers
• In this chapter of the notes we will deviate from the text
Chapter 10 and focus more on specific applications of signal
processing
Chapter 10: Introduction
10–1
ECE 1010 ECE Problem Solving I
Sinusoidal Signals
• One of the simplest signals that we deal with in both the continuous and discrete time domains is the cosine function
x c ( t ) = A 1 cos ( 2πf 1 t + φ 1 ), – ∞ ≤ t ≤ ∞
(10.1)
• A signal composed of a single sinusoid has three specific
attributes:
– The sinusoid has amplitude A 1 (units of voltage or current)
– The sinusoid oscillates with frequency f 1 (units of cycles
per second or Hz if t has units of seconds)
– The sinusoid is phase shifted by φ (units of radians or
degrees)
• x c ( t ) is known as a time-domain representation of a signal
• A second, and equally useful representation of a signal, is the
frequency domain
Frequency Domain
• The frequency domain representation of a single sinusoid
consists of both an amplitude spectrum and a phase spectrum
– The amplitude spectrum is a plot of signal amplitude versus frequency
– The phase spectrum is a plot of signal phase versus frequency
Chapter 10: Sinusoidal Signals
10–2
ECE 1010 ECE Problem Solving I
• Formally, the spectrum of x c ( t ) , denoted X c ( f ) , is obtained
by taking the Fourier transform, i.e.,
Xc ( f ) =
∞
∫–∞
x c ( t )e
– j2πft
(10.2)
dt
• For a sinusoid the complexity of (10.2) is not really needed
• Intuitively, the spectrum of a single sinusoid is as shown
below
A1
cos φ
t
xc ( t )
–A1
1
Period T 1 = ---f1
Xc ( f )
Amplitude
Spectrum
A1
Time
Domain
Freq.
Domain
f, Hz
0
Chapter 10: Sinusoidal Signals
f1
10–3
ECE 1010 ECE Problem Solving I
• We now extend the above frequency domain intuition to a
signal composed of two sinusoids
x c ( t ) = A 1 cos ( 2πf 1 t + φ 1 ) + A 2 cos ( 2πf 2 t + φ 2 )
A1
(10.3)
t
#1
1
T 1 = ---f1
A2
t
#1
1T 2 = --f2
t
xc ( t )
Time
Domain
Freq.
Domain
Xc ( f )
Amplitude
Spectrum
A1
A2
f, Hz
0
Chapter 10: Sinusoidal Signals
f1
f2
10–4
ECE 1010 ECE Problem Solving I
Discrete-Time Sinusoids
• Digital signal processing of a continuous-time or analog signals can be accomplished by uniformly sampling x c ( t ) every
T seconds, e.g.,
x [ n ] = x c ( nT ) = A 1 cos ( 2πf 1 nT + φ 1 ), – ∞ ≤ n ≤ ∞
(10.4)
• A discrete-time or digital signal is just a sampled version of a
corresponding analog signal
• A single sinuoid is again characterized by three attributes
– Actually there is now a fourth attribute, T, the sampling
period or its inverse, the sampling frequency f s = 1 ⁄ T
• To avoid aliasing, a condition that occurs when analog signals are sampled, we must have the sampling frequency, f s ,
greater than twice the highest frequency component contained in x c ( t )
• If we violate this condition the higher frequencies of the signal, those exceeding f s ⁄ 2 , will alias as lower frequencies in
the frequency range 0 to f s ⁄ 2
• Typically a digital signal is stored on memory as a data
record or processed in real-time following analog-to-digital
conversion
• An N-point data record is typically stored with starting index
0 and ending index N – 1 , e.g., when captured from an analog signal we might have
x [ n ] = x c ( nT ), n = 0, 1, …, N – 1
Chapter 10: Sinusoidal Signals
(10.5)
10–5
ECE 1010 ECE Problem Solving I
• In MATLAB we typically display a discrete-time or digital
signal using the stem() function
• Popular sampling frequencies used in PC sound systems are
submultiples of the compact disc (CD) audio standard which
has f s = 44.1 kHz
Example: Discrete-time Sinusoid Generation
• Suppose we wish to created a sampled sinusoid which has a
frequency of 1000 Hz, is sampled at 44,100/4 = 11,025 Hz,
and has duration of approximately 2 seconds
• A 2 second record will contain
2 × 11025 = 22050 samples
• MATLAB Code to Generate the sinusoid:
»
»
»
»
»
»
»
% Create a signal index first
N = 22050;
n = 0:N-1;
x1 = cos(2*pi*1000*n/11025);
% Plot a small of portion of the signal
stem(n(1:50),x1(1:50))
title('1 kHz Sinusoid with fs = 11.025 kHz',...
'fontsize',18)
» ylabel('Amplitude','fontsize',14)
» xlabel('Sequence Index - n','fontsize',14)
• Assuming your computer is equipped with a sound card, this
2 second record can be played using the MATLAB function
sound(x,fs)
» Play the sound vector x1 with fs = 11025 Hz
» sound(x1,11025)
Chapter 10: Sinusoidal Signals
10–6
ECE 1010 ECE Problem Solving I
1 kHz Sinusoid with fs = 11.025 kHz
1
0.8
0.6
Amplitude
0.4
0.2
0
-0.2
-0.4
-0.6
-0.8
-1
0
5
10
15
20
25
30
35
40
45
50
Sequence Index - n
– Note: Each sample in the above signal is spaced by T = 1/
11025 sec with respect to the underlying analog signal
Discrete-Time Sinusoids in the Frequency Domain
• A frequency domain representation of a discrete-time signal
can be obtained through the use of the fast Fourier transform
(FFT), formally defined for an N-point data record as
N–1
X[ k] =
∑ x [ n ]e
– j2πkn
--------------N
, k = 0, 1, …, N – 1
(10.6)
n=0
Chapter 10: Sinusoidal Signals
10–7
ECE 1010 ECE Problem Solving I
• In MATLAB this is accomplished using fft(n) or
fft(x,N) where N is the number of points used in the FFT
– If the vector x has length greater than N points, the record
x is truncated to N points
– If the vector x has length less than N points, the record is
zero padded (zeros are appended to x) to length N
• The function X=fft(x,N) returns a length N complex vector, X, whose magnitude is proportional to the amplitude
spectrum of x [ n ] and whose angle is the phase spectrum of
x[n]
• Each index of X corresponds to an analog frequency of
k
f k = ---- f s, 0 ≤ k ≤ N – 1
N
(10.7)
in the spectrum of x c ( t ) , that is X c ( f )
Example: Continuation of the single sinusoid example
• Using MATLAB the spectrum of the vector x1 used in the
previous example is
»
»
»
»
»
»
X1 = fft(x1(1:128),1024); % N=128pts padded to 1024pts
% Create a frequency axis vector on 0 to fs/2
f = [0:512]*11025/1024;
plot(f,abs(X1(1:513)))
grid
title('1 kHz Sinusoid Spectrum (fs = 11.025 kHz)',...
'fontsize',18)
» ylabel('|X1(k)|','fontsize',14)
» xlabel('Index k Scaled to Frequency in Hz',...
'fontsize',14)
Chapter 10: Sinusoidal Signals
10–8
ECE 1010 ECE Problem Solving I
1 kHz Sinusoid Spectrum (fs = 11.025 kHz)
70
60
A Single Spectral
Line at 1000 Hz as
Expected
|X1[k]|
50
40
30
20
10
0
0
1000
2000
3000
4000
5000
6000
Index k Scaled to Frequency in Hz
– Note: The amplitude is scaling does not match the singlesided spectrum of a sinusoid shown earlier unless we
divide by the record length over two, i.e., plot X [ k ] ⋅ 2 ⁄ N
Transfer Functions and Filters
Both analog and digital signals can be processed by filters to produce modified signals. The MATLAB signal processing toolbox
contains a vast array of filter design functions.
Chapter 10: Transfer Functions and Filters
10–9
ECE 1010 ECE Problem Solving I
Analog Frequency Response (Transfer) Functions
• Consider a sinusoid passing through an analog filter
A cos ( 2πf o t + θ )
xc ( t )
B cos ( 2πf o t + θ + φ )
Analog
Filter
yc ( t )
• A sinusoid is returned at the output, but the amplitude and
phase are modified by the filters frequency response function
A→B
θ→θ+φ
• In the frequency domain a filter is described as having a frequency response function (a complex function of frequency)
which tells us the amplitude gain and phase shift imparted to
a sinusoidal signal at a particular frequency
• If the analog filter depicted above has frequency response
function H c ( f ) , then the output sinusoid is related to the
input sinuoid and H c ( f ) as follows
y c ( t ) = A H c ( f o ) cos [ 2πf o t + θ + ∠H c ( f ) ]
(10.8)
• The four main filter types are lowpass, highpass, bandpass,
and bandstop
1
1
fc
fc
Lowpass
f
1
Highpass
f
1
Chapter 10: Transfer Functions and Filters
B
fo
fo
Bandpass
f
Bandstop
f
10–10
ECE 1010 ECE Problem Solving I
• Analog lowpass filters are usually designed to meet a set of
amplitude response requirements in the frequency domain
Lowpass
1
Filter
1 ⁄ Ap
Hc ( f )
Transition
Band
Passband
Stopband
1 ⁄ As
0
0
fp
f
fs
– The actual filter amplitude response, H c ( f ) , just needs to
fall within the ‘white space’
– 1 ⁄ A p is the minimum filter gain in the passband
– 1 ⁄ A s is the maximum filter gain in the stopband
• MATLAB has a collection of functions in the signal processing toolbox that designs analog filters in transfer function
form, i.e.,
n
n–1
+ … + bn
b0 s + b1 s
H ( f ) = ----------------------------------------------------------n
n–1
a0 s + a1 s
+ … + an
(10.9)
s = j2πf
Digital Frequency Response Functions
• In the discrete-time domain filters can also be designed
• The same basic concepts apply
– When a discrete-time sinusoid is applied to a linear filter,
Chapter 10: Transfer Functions and Filters
10–11
ECE 1010 ECE Problem Solving I
the output is a sinusoid of the same frequency, but amplitude attenuated and phase shifted
– Given a digital filter has frequency response H ( f ) we can
write for x [ n ] = A cos ( 2πf o nT ) that
y [ n ] = A H ( f o ) cos [ 2πf o nT + θ + ∠H ( f o ) ]
(10.10)
Applications
Compact Disc Digital Audio
• Digital audio, CD digital audio, relies on real-time digital
signal processing, coding theory, and control theory to function
• CD recording frame format
CD
Data (96 bits)
sync subcode
Data (96 bits)
Parity
(32 bits)
Parity
(32 bits)
• The raw input rate for stereo is 1.41 Mb/s ( 2 ⋅ 16 ⋅ 44100 ),
but with overhead this is increased to 4.3218 Mb/s
• An hour of music requires about 15.5 Billion bits
• Maximum playing time is about 74 minutes, enough for
Beethoven’s 9th symphony
Chapter 10: Applications
10–12
ECE 1010 ECE Problem Solving I
Communication Systems
Frequency
Spectrum
• Consider the commercial broadcast frequency spectrum
AM
Radio
TV
2-6
535–1605 kHz
FM
Radio
TV
7-13
54-88 88.1–17.9
MHz
MHz
174–216
MHz
Spectrum at
Discriminator
Output
• FM stereo receiver
L + R 19 kHz
Pilot ( L – R ) cos ( 2πf sc )
0
15
19
23
LPF
0-15 kHz
Limiter
Discriminator
53
L+R
+
L
Σ
+
BPF
~19 kHz
BPF
23-53kHz
Chapter 10: Applications
38
Demodulator
+
- Σ
L–R
R
10–13
ECE 1010 ECE Problem Solving I
Bat Echo Location Signal Processing
• Bat echo-locate using frequency chirps above the human
hearing range
• To allow humans to listen to bat echo location we must first
frequency translate the bat chirp frequency spectrum down to
the human hearing range
Bat Echo Location
Human
Hearing
0
16
f, kHz
30
100
Frequency Translate
a Portion into Human Range
• The front-end to a system for processing bat chirps is a
microphone array
• The output is an audio signal that can be recorded on magnetic tape (a cassette) and later digitized using a PC audio
system
Chapter 10: Applications
10–14
© Copyright 2026 Paperzz