5.
9 DSP II:
Math Background
Dr. Tarek A. Tutunji
Mechatronics Engineering Department
Philadelphia University, Jordan
Overview
In introduction to DSP was given in the
previous sequence
In this sequence, basic mathematical
background of common used algorithms in
DSP is provided. This will include
• Correlation
• Convolution
• Digital Filtering
• Power Spectrum
Classification of
Discrete-Time systems
Static vs. Dynamic
Time-invariant vs. time-varying
Linear vs. nonlinear
Causal vs. noncausal
Stable vs. nonstable
We are interested in LTI (Linear Time-Invariant) causal Systems
Correlation
Correlation between two signals is a measure of the
degree to which the two signals are similar and for how
long they remain similar when one is shifted with respect
to the other.
• Correlation is maximum when the signals are similar in
shape and are in phase
The cross-correlation of two signals, x(n) and y(n), is
given by
r xy (k) x(n)y(n k)
k -
• One signal is shifted with respect to the other
• Each element of one signal is multiplied by the corresponding
element of the other
• The area under the resulting curve is integrated
• Correlation requires a lot of calculations.
Convolution
Consider a system h(n) with input x(n) and output y(n)
x(n) h(n) y(n)
Then, y(n) x(n)* h(n)
If the input is a pulse d(n) the output y(n) = h(n)
Convolving two signals is equivalent to multiplying the
frequency spectra of the two signals together
y(n) x(n) * h(n)
Y(Z) X(Z)H(z)
Convolution
Convolution is used for digital filtering.
The convolution of two signals, x(n) and h(n), is given by
y(n) x(n)* h(n) x(n)h(n k)
k -
• Folding, h(k) around 0 to get h(-k)
• Shifting, h(-k) by n0 to right (left) if n0 is positive (negative)
• Multiply x(k) by h(n0-k)
• Sum all values at time n=n0
Fourier Transform
Most signals can be decomposed into sum of sinusoidal signal
components (with the appropriate amplitude, frequency, and
phase)
• For class of periodic signals, the decomposition is called Fourier Series
• For the class of finite energy signals, the decomposition is called the
Fourier Transform
The Fourier transform is an equation to calculate the frequency,
amplitude and phase of each sine wave needed to make up any
given signal.
The Fourier Transform (FT) is a mathematical formula using
integrals
The Discrete Fourier Transform (DFT) is a discrete numerical
equivalent using sums instead of integrals
The Fast Fourier Transform (FFT) is a computationally fast way to
calculate the DFT
Fourier Transform
Z-Transform (one-sided / causal) is
X(z) x(n)Z - n
n 0
By letting z = ejw and w = 2pf = 2pk/N
X(e jω
) x(n)e - jω
n 0
2π
N 1 - j kn
Xk x(n)e N
Where Xk is the Discrete
n 0 Fourier Transform (DFT)
Digital Filters
There are two main kinds of filter, analog and digital.
An analog filter uses analog electronic circuits as explained
in session 3 (signal conditioning)
A digital filter uses a digital processor to perform numerical
calculations on sampled values of the signal.
The analog input signal must first be sampled and digitized
using an ADC
In a digital filter, the signal is represented by a sequence of
numbers, rather than a voltage or current.
The following diagram shows the basic setup of such a
system.
Analog vs. Digital Filters
Analog Digital
Noise Immunity No Yes
Programmable No Yes
Design Difficult Easy
# of Components Large Small
# of Applications Small Large
Resolution Low High
Modification Difficult Easy
Sensitivity High Low
High Frequency Yes Yes
Low Frequency No Yes
ARMA model
Auto Regressive Moving Average (ARMA) model with
input x(n) and output y(n) is given below
n m
y(n) ak y(n k) bk x(n k)
k 1 k 0
By taking the z-transform and manipulating the result, we get
n m
Y(Z) ak Z Y(z) bk Z - k X(z)
-k
k 1 k 0
n m
Y(z) ak Z - k Y(z) bk Z - k X(z)
k 1 k 0
n m
Y(z)(1 ak Z -k
) X(z)( bk Z - k )
k 1 k 0
m
bk Z - k
Y(z) k 0
H(z)
n
which is the Transfer Function
X(z)
1 ak Z - k
k 1
IIR and FIR Filters
Infinite Impulse Response (IIR) filters contain
both poles and zeros and therefore depend on
inputs and delayed outputs. So in the time
domain the are ARMA
Finite Impulse Response (FIR) filters contain only
zeros (i.e. no poles) and therefore depend only
on inputs. So in the time domain they have only
the MA (Moving Average) part
Designing digital filters is the process of finding
the appropriate coefficients (a’s and b’s) to
obtain the desired system response
Example
Consider the ARMA equation
y(n) x(n) 0.7y(n 1)
x(n) y(n)
+
0.7
Z-1
The transfer function is
1
H(z)
1 0.7z 1
Example: Pole-Zero Plot
Pole at 0.7
Example: Frequency Response
Low pass filter
Example: Impulse Response
Stable system since
Pole < 1
Power Spectrum
Spectral Analysis
• Captures the frequencies present in a signal
• Estimates the sine waves that can be added to create a
duplicate of a given signal
Power Spectrum (or Frequency Spectrum)
• Decomposes a signal into its basic frequency components
• Calculates the power in each of those frequencies
• Shows the distribution of the power in the frequency domain
Understanding the relation between time and frequency
domains is useful:
• some signals are easier to visualize in the frequency domain
while others are easier to visualize in the time domain
• Some signals take less information to define in the time
domain while others take less information to define in the
frequency domain
Power Spectrum
The Power Density Spectrum is the Fourier
Transform of the autocorrelation function
N 1
j2pfm
Pxx (f) xx
r (m)e
m ( N 1)
We can also calculate the power spectrum from
the DFT as follows
1 2
Pxx ( k ) Xk
N
Example
Consider the time domain signal
Example
The Power Spectrum is given below
3rd component at k=13
4th component at k=18 mirror image
2nd component
at k=5
1st component
at k=2
The original frequencies in the signal depend on Sampling
used, frequency = (k/50)*Fs
So if Fs = 4KHz 1st frequency is 160 Hz
Summary
The basic theory and math behind
commonly used DSP algorithms were
provided. This included
• Correlation
• Convolution
• Digital Filters
• Power Spectrum