0% found this document useful (0 votes)
20 views

DSP Intro

Uploaded by

Samuel Ebbah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

DSP Intro

Uploaded by

Samuel Ebbah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 55

Digital Signal Processing

Prof. E. K. Akowuah
[email protected]
5/16/23 Digital Signal Processing 1
Overview
• Introduction to DSP Systems

• Discrete Time Systems

• Frequency domain analysis of Discrete Time Systems

• IIR Filters

• FIR Filters

• Examples using Matlab

5/16/23 Digital Signal Processing 2


DSP and Engineering

• DSP
– mathematics, algorithms, and the techniques used to
manipulate digital signals
• Signals
– seismic vibrations, visual images, sound waves, etc.
• Our goal
– enhancement of visual images, speech recognition
and generation, data compression for storage and
transmission, etc.

5/16/23 Digital Signal Processing 3


DSP and Engineering

• Dates back to 60s and 70s with limited


applications in
– radar & sonar, where national security was at risk
– oil exploration, where large amounts of money could
be made
– space exploration where the data are irreplaceable
– medical imaging, where lives could be saved.
• From the 80s
– Rapid expansion of application of DSP due to
improvement in computer architecture

5/16/23 Digital Signal Processing 4


This technological revolution occurred from the top-down. In the early
1980s, DSP was taught as a graduate level course in electrical engineering.
A decade later, DSP had become a standard part of the undergraduate

DSP and Engineering


curriculum. Today, DSP is a basic skill needed by scientists and engineers

-Space photograph enhancement


Space -Data compression
-Intelligent sensory analysis by
remote space probes

-Diagnostic imaging (CT, MRI,


Medical ultrasound, and others)
-Electrocardiogram analysis
-Medical image storage/retrieval

-Image and sound compression


Commercial for multimedia presentation
-Movie special effects
-Video conference calling

DSP Telephone
-Voice and data compression
-Echo reduction
-Signal multiplexing
-Filtering

-Radar
Military -Sonar
-Ordnance guidance
-Secure communication

-Oil and mineral prospecting


Industrial -Process monitoring & control
-Nondestructive testing
-CAD and design tools

-Earthquake recording & analysis


Scientific -Data acquisition
-Spectral analysis
-Simulation and modeling

FIGURE 1-1
5/16/23 Digital
DSP has revolutionized Signal
many areas Processing
in science and engineering. A 5
few of these diverse applications are shown here.
disciplines are not sharp and well defined, but rather fuzzy and over
If you want to specialize in DSP, these are the allied areas you w
DSP and Engineering
need to study.

Communication
Theory
Digital Numerical
Signal Analysis

Processing Probability
and Statistics

Analog
Signal
Processing
Analog Digital Decision
Electronics Electronics Theory

5/16/23 Digital Signal Processing 6


FIGURE 1-2
Advantages of DSP

• Accuracy: The analog circuits are prone to


temperature and external effects, but the digital
filters have no such problemsradar & sonar,
where national security was at risk
• Flexibility: Reconfiguration of analog filters is
very complex whereas the digital filters can be
reconfigured easily by changing the program
coefficients.

5/23/23 Digital Signal Processing 7


Advantages of DSP

• Easy operation: Even complex mathematical


operations can be performed easily using
computers, which is not the case with analog
processing.
• Multiplexing: Digital signal processing provides
the way for Integrated service digital network
(ISDN) where digitized signals can be
multiplexed with other digital data and
transmitted through the same channel.

5/23/23 Digital Signal Processing 8


Limitations of DSP

• Bandwidth restrictions.
• Speed limitations
• Finite word length problems.

5/23/23 Digital Signal Processing 9


A Typical DSP System
ADC
x(t) Anti- with x[n] Digital y[n] Anti- y(t)
aliasing Sample Signal DAC Imaging
Filter and Processor Filter
Hold

The analogue anti-aliasing filter (AAF) is needed prior to digitisation to limit


the bandwidth of the signal.

The analogue anti-imaging filters removes signal images and unwanted high
frequency components

The ADC (Analog-to-Digital Converter) converts a continuous analogue


signal into a discrete time discrete value sampled data stream

The DAC (Digital to Analogue Converter) converts the digital signal back into
analogue form

5/16/23 Digital Signal Processing 10


The Sampling Process

xa ( t ) x* ( t ) xq (t ) x ( nT ) = x [ n ]
Quantiser
(Analog to Coding
Sample Digital
and Conversion)
Hold

Analog Signal Discrete Time Discrete Time Sampled


Analog Signal and Magnitude Data
Signal

5/16/23 Digital Signal Processing 11


Analogue to Digital Conversion
• The analogue signal is continuous in both time and amplitude

• The (band-limited) signal is first sampled (usually with a sample and hold
circuit) to produce a discrete-time, continuous amplitude signal

• The amplitude of each sample of the signal is quantised into one of 2B


levels, where B is the number of bits used to represent the sample in the
ADC.

• The discrete amplitude levels are encoded into discrete binary words, each
of length B bits.

• The digital signal x[n] (n = 1, 2, 3, …) exists only at discrete points in time


and can only have one of 2B values. It is a discrete-time, discrete valued
signal.

5/16/23 Digital Signal Processing 12


Ideal Sampled Data System

dT ( t )

¥
x ( t ) = xa ( t ) d T ( t ) = xa ( t ) å d ( t - nT )
n =-¥

xa ( t ) Impulse xa ( t ) d T ( t )
Modulator

5/16/23 Digital Signal Processing 13


Ideal Sampled Data System
1 for t = 0
The unit impulse d(t ) is defined as d(t ) = ìí
î0 for t ¹ 0

A train of unit impulses can be seen as


the superposition of a set of shifted discrete-time unit impulses.

dT (t ) = d(t + ¥T ).... + d(t + 2T ) + d(t + T ) + d(t ) +


d(t - T ) + d(t - 2T ) + .... + d(t - ¥T )

¥
= å d(t - nT )
n = -¥

d(t - nT ) a delayed unit impulse occurring at t = nT

d(t + nT ) is an advanced unit impulse occurring at t = -nT

5/16/23 Digital Signal Processing 14


Ideal Sampled Data System

the sampled signal xs ( t ) can be written as


¥
xs ( t ) = xa ( t ) d T ( t ) = xa ( t ) å d ( t - nT ) (1)
n =-¥

As the unit strength impulse train is a periodic signal it can be expanded as a


weighted (scaled) sum of complex exponential components (i.e. as a Fourier
Series) with frequencies that are multiples of the sampling frequency.

¥ 2p
dT (t ) = å Cn e jnw s t ws = sampling frequency = radians per second
n = -¥
T
1T
Cn = ò dT (t ) e - jnw s t dt
T0

5/16/23 Digital Signal Processing 15


Ideal Sampled Data System

For the periodic delta pulse stream it can be shown that for all n

¥
1 1
Cn =
T
and hence d T ( )
t =
T
åe
n =-¥
jnws t

Therefore (1) may be rewritten as

1 ¥
xs ( t ) = xa ( t ) d T ( t ) = å xa ( t ) e jnwst (2)
T n =-¥

5/16/23 Digital Signal Processing 16


Ideal Sampled Data System

The Fourier Transform X ( jw ) of the signal x ( t ) is defined as

¥
X ( jw ) = ò x (t ) e
- jw t
dt (3)

The Fourier Transform X s ( jw ) of a sampled signal xs ( t ) is, from (2) and (3)
¥ ¥
æ1 ¥ ö 1 æ ¥ ö - j w - n ws ) t
X s ( jw ) = ò ç å xa ( t ) e jn ws t ÷ e - jw t dt = ò ç å xa ( t ) ÷ e ( dt
-¥ è
T n =-¥ ø T -¥ è n =-¥ ø

¥
1 ¥
= å xa ( t ) e
- j (w - n ws ) t

T n =-¥ ò

dt (4)

5/16/23 Digital Signal Processing 17


Ideal Sampled Data System
¥
xa ( t ) e
- j (w - n ws ) t
Note that the term = ò

dt

is equivalent to the Fourier Transform X a ( j (w - n ws ) ) . Hence

1 ¥
X s ( jw ) = å X a ( j (w - n ws ) ) (5)
T n =-¥

5/16/23 Digital Signal Processing 18


The Sampling Theorem
• The spectrum is the same as the original analogue spectrum, but repeats at
multiples of the sampling frequency, ws = 2p f s
• The higher order components which are sampled on multiples of ws
are called image frequencies
X a( j w )

-wB 0 wB w

X a( j w )

-2ws -ws 0 ws 2ws w

5/16/23 Digital Signal Processing 19


The Sampling Theorem
Xa( jw)

-2ws -ws 0 ws 2ws w

• If the sampling frequency is not sufficiently high the image frequencies will
fold over or alias into the base band frequencies.

• In this case the information of the desired signal is indistinguishable from its
image in the fold-over region.

• The overlap or aliasing occurs about a point that is half the sampling frequency.
This point is called the folding frequency or Nyquist frequency.

5/16/23 Digital Signal Processing 20


The Sampling Theorem

If the highest frequency component in a signal is f max

then the signal should be sampled at a rate of at least f s ³ 2 f max

for the samples to describe the signal completely.

f s is the sampling frequency or sampling rate.

5/16/23 Digital Signal Processing 21


The Sampling Theorem

The sampling frequency can also be stated as:

If xa ( t ) is a strictly bandlimited signal such that X a ( jw) = 0 w >w0

Then xa ( t ) may be uniquely recovered from its samples xa ( nTs ) if


2p
ws = ³ 2w0
Ts

The frequency w 0 is called the Nyquist Frequency,

and the minimum sampling frequency ws = 2w 0 is called the Nyquist rate.

5/16/23 Digital Signal Processing 22


Anti-aliasing filters (AAF)
• Analogue pre-filtering used to reduce the effects of aliasing by bandlimiting signals
prior to being sampled.

• Similar improvements can also be achieved by increasing sampling rate


(oversampling).

• The ideal anti-aliasing filter should remove all frequency components above
the Nyquist frequency (also called the foldover frequency).

• In practice aliasing is always present because of system noise and the existence of
signal energy outside the band of interest.

• The problem is to decide on the level of aliasing that is acceptable and to


design a suitable anti-aliasing filter and an appropriate sampling rate to
achieve this

5/16/23 Digital Signal Processing 23


Practical AAF Filters

5/16/23 Digital Signal Processing 24


Practical Anti – Aliasing Filters
• The practical response introduces amplitude distortion into the signal as the
passband is not flat.

• The signal components with frequencies greater than fs will be attenuated


by Amin, but those between fc and fs, the transition width, will have their
amplitudes reduced monotonically.

• For many practical filters the effective Nyquist frequency is taken as fs (the
stopband edge of the frequency response).

• It is usual to take the ADC resolution requirements into account when


designing the AAF.

• the AAF will be designed to attenuate the frequencies above the Nyquist
frequency to a level not detectable by the ADC.

5/16/23 Digital Signal Processing 25


Practical Anti-Aliasing Filters
• For a system using a B-bit linear ADC, the minimum stopband attenuation
of the filter would typically be

Amin = 20log ( )
1.5 ´ 2 B +1 .

where B is the number of bits in the ADC

n Amin(dB)
8 56

10 68

12 80

16 104

5/16/23 Digital Signal Processing 26


Practical Anti-Aliasing Filters
• The use of analogue “front-end” filters also introduces other problems such
as phase distortion.

• A general rule is that the steeper the cut-off of an analogue filter, the greater
the phase distortion.

• Today high sampling frequencies (i.e oversampling) is frequently used to


offset the problems of AAF.

– High sampling frequencies lead to the use of simpler AAFs.

– Oversampling with additional signal processing can result in an improved signal


to noise ratio.

5/16/23 Digital Signal Processing 27


Example
Example
Determine the minimum sampling frequency FS, to give an aliasing error of less
than 2% of the signal level in the passband.

The amplitude response of the active filter is given by:


1 1
H( f ) = 1
where fc = = 2kHz
é æ f ö2 ù 2 2pRC
ê1 + çç ÷÷ ú
êë è f c ø úû

- Sample
and
Analogue
+ Hold Sampled
Signal
Input Signal
Fs

5/16/23 Digital Signal Processing 28


Example

At 2 kHz the signal level Xb = 0.7071

The desired aliasing level is < 0.7071´ 2 100 = 0.01414 f < 141.4kHz
a
X(f)
1
Hence 0.01414 < 1
é æ fa ö ù 2 2
ê1 + ç ÷ ú
êë è 2 ø úû
f (kHz)

X ¢( f )
where fa is the aliasing frequency.
1
Fs (min ) = f c + f a = 2kHz + 141.4kHz = 143.4kHz Xb

Xa
-Fs 0 2 fa Fs f (kHz)

5/16/23 Digital Signal Processing 29


Example
12 bit
Anti-aliasing
ADC y(t)
x(t) Filter x(n) Digital y(n) Anti-
with 12 bit
Signal Imaging
Sample DAC
(3rd order Processor Filter
and
Butterworth)
Hold

Assuming that the band of interest for the above DSP system extends from 0 to
4 kHz and that a 12-bit ADC is used, estimate the:

• minimum stopband attenuation, Amin for the anti-aliasing filter;


• sampling frequency Fs;
• level of aliasing error relative to the signal level in the passband for
the estimated Amin and Fs.

State any assumptions you have made.

5/16/23 Digital Signal Processing 30


Example

The AAF should attenuate the levels of frequencies in the stopband to less than
the root mean square (rms) quantisation noise level for the ADC, so that they are
not detectable by the ADC.
12
æ a2 ö a
Assuming the RMS quantisation noise level is çç ÷÷ =
è 12 ø 2 3

V fs V fs
where the quantisation level a is given by a = »
2B -1 2B

æ a 2B ö
ç ÷
Max passband level è 2 ø
and a full-scale input, then Amin = = = 1.5 ´ 2 B +1
stopband signal level æ a ö
ç ÷
è2 3ø

5/16/23 Digital Signal Processing 31


Example

Hence Amin = 20log 1.5 ´ 2 (


B +1
) B =12 = 80dB

Choosing (this time) the folding frequency Fs/2 as the effective stopband
frequency, then, for a 3rd order Butterworth filter
X ( f ) dB
6 12
é æ f ö ù
Amin = 20log ê1 + çç ÷÷ ú
êë è f c ø úû

For fc = 4KHz Amin = 83 dB f (kHz)

X ¢ ( f ) dB
Giving f = Fs/2 > 96.7 kHz
0
-3
Thus Fs = 193.4 kHz (say 194 kHz).
-83
-Fs - Fs 2 0 4 Fs 2 Fs f (kHz)

5/16/23 Digital Signal Processing 32


Example

The aliasing level at 4 kHz is

1
12
= 9.33 ´ 10-6
ìï é (194 - 4 ) ù 6 üï
í1 + ê ú ý
ïî ë 4 û ïþ

And the aliasing level relative to signal level at 4 kHz is

100
( 9.33 ´10 ) ´ 0.7071
-6
= 0.0013 %

5/16/23 Digital Signal Processing 33


Aperture Time
• A digitised signal is measured over a finite period of time it is not
instantaneous.

• Non-zero “aperture time” limits the maximum frequency and absolute


accuracy when it is being digitised because the signal is changing while it is
being sampled.

• Assume that the system is designed to ensure that the input voltage can
only change by a maximum of 1/2 LSB between samples.

• Then for a sine wave it can be shown that the maximum frequency that can
be digitised to 1/2 LSB accuracy for a system using B-bit accuracy is given
by:
1
f max = B +1
where t is the aperture time
p2 t

5/16/23 Digital Signal Processing 34


Aperture Time

Proof Assume that t is the aperture time and Dv is the change in v(t) during t

Vfs
v (t) = sin w t
2
The point of greatest change is at t =
0 and the ADC must be able to
Vfs
measure the signal with the desired
2
accuracy at this point or

dv(t ) æ V fs ö Dv
t =0 = çç ÷÷wcos(wt ) = pfV fs = (Vs -1 ) 0
dt è 2 ø t DV t (s)

t
-Vfs
2

5/16/23 Digital Signal Processing 35


Aperture Time
a
For 1/2 LSB accuracy Dv =
2
æ V fs ö
where a = çç B ÷÷
è2 ø

Dv
Substituting for Vfs and Dv in the equation gives p f V fs =
t

1
and simplifying gives f max =
p2 B +1 t

5/16/23 Digital Signal Processing 36


Example (Aperture)

Consider a DSP system with B =12 and t = 35ms

f max = 1.1 Hz

If the above ADC was preceded by a sample and hold amplifier with an
aperture of 25ns and an acquisition time of 2ms, then the maximum
frequency that can be converted becomes:

1
2 f max £ Fs = ´ 10 -6 kHz
(35 + 2 + 0.025) = 13.5 kHz

5/16/23 Digital Signal Processing 37


Quantisation
Before conversion to digital the analogue sample is assigned to one of 2B
values. This process is called quantisation and introduces errors, which cannot
be removed.
The level of the error is a function of the ADC being used but is approx. equal
to 1/2 LSB.

For a 12 Bit ADC with in input voltage range of ± 10 V the LSB is

20
12
mV = 4.9 mV
2

and the quantisation error is 2.45 mV.

5/16/23 Digital Signal Processing 38


Quantisation
In general an ADC with B digits has 2B quantisation steps and the
quantisation step size q is given as

V fs V fs
q= »
(2 B
)
-1 2B

where Vfs is the full scale range of the ADC with bipolar inputs

q
The maximum quantisation error is ±
2

5/16/23 Digital Signal Processing 39


Quantisation

For a sine wave of amplitude A (with 2A=Vfs) the quantisation step size is
2A
q=
2B
If it is assumed that for such a signal the quantisation error e for each
sample is random and uniformly distributed in the interval ± q 2 with zero mean
then the quantisation noise power (or variance) is given by

q 2 q 2
1 q2
s e2 = ò e P(e )de = ò e de =
2 2

-q 2 q -q 2 12

q
or the RMS noise power is RMS =
12

5/16/23 Digital Signal Processing 40


Quantisation

For this system the signal to quantisation noise power (SQNR) in decibels is

æ A2 2 ö æ 3 ´ 22 B ö
SQNR = 10logçç 2 ÷÷ = 10logçç ÷÷ = 6.02B + 1.76 dB
è q 12 ø è 2 ø

This is a theoretical maximum

5/16/23 Digital Signal Processing 41


Example

If the dynamic range of the ADC in example 1 is to be greater than 70 dB and


the samples are digitised to 1/2 LSB accuracy, determine the:

• minimum resolution of the ADC in bits;

• maximum allowable aperture time, assuming the highest


frequency of interest to be digitised is 20 kHz.

5/16/23 Digital Signal Processing 42


Example

Dynamic range is the ratio of maximum to minimum values, often defined as

D = 20log10 2 B

70 = 20log10 2 B giving B = 11.62 or B=12 (integer bits)

The minimum aperture time is given by

1 1
t= B +1
= 13 3
s = 1.94 ns
2 pf max 2 ´ p ´ 20 ´ 10

The small aperture time calls for the need for a sample and hold ahead of the ADC.

5/16/23 Digital Signal Processing 43


Digital To Analogue Conversion: Signal Recovery
y [nT]
DSP

y [nT]
nT
y (t )
DAC

y (t )
T t

y (t)
LPF

y (t)

5/16/23 Digital Signal Processing 44


Digital to Analogue Conversion: Signal Recovery

• The DAC shown is a zero-order hold. The signal output is held for a time T (the
sampling period).
wT
• In the frequency domain this results in sinx/x distortion where x =
2
• The output is wideband – original signal plus images at multiples of the sampling
frequency

• The amplitude of the output is multiplied by the sinx/x function which acts like a low
pass filter (LPF).

• The sinx/x function causes signal distortion. It is sometimes corrected by applying a


transform to the output signal that has an amplitude-frequency response of the type
x/sinx before being converted.

5/16/23 Digital Signal Processing 45


Digital to Analogue Conversion:Signal Recovery
Input
y [ nT ] YD (w )

nT 0 ws 2ws w

Output
y (t ) Y (w )

sin x
x

T t 0 ws 2ws w

5/16/23 Digital Signal Processing 46


Digital to Analogue Conversion:Signal Recovery

• The output is wideband – original (sampled/filtered) signal plus images at


multiples of the sampling frequency

• The amplitude of the output is multiplied by a sinx/x function which acts as a


low-pass filter.

• The sinx/x function causes distortion in the passband. It is sometimes


compensated by applying a x/sinx function to the output signal prior to
conversion back into the analogue domain.

5/16/23 Digital Signal Processing 47


The “zero-hold” DAC

The unit impulse response of the zero-order hold linear filter is

ì1 for 0 £ t £ T
h(t ) = í
î0 otherwise

d(t) h(t)

zero-order hold
1 1
linear filter

0 t 0 T t

5/16/23 Digital Signal Processing 48


The “zero-hold” DAC

The corresponding frequency response of the zero-order hold linear filter (the
D/A converter) is obtained by taking the Fourier transform of the unit-impulse
response. That is
¥
H ( jw ) = ò h(t ) e - jw t dt
T
= ò 1 ´ e - jw t d t
-¥ 0

T
ée ù-jw t -1 - jwT
=ê = éëe - 1ùû
ú jw
ë - j w û0
- jwT - jwT
- jwT jwT é jw2T - jwT
ù
ée 2 ù 2e 2
ê e - e 2
ú
= êe
2
-e 2
ú =
jw ë û w ê 2j ú
êë úû
5/16/23 Digital Signal Processing 49
The “zero-hold” DAC

æ wT ö
sin ç ÷ j wT
è 2 ø -
= ´T e 2
wT
2

sin x -
j wT
wT
= ´T e 2
where x=
x 2

5/16/23 Digital Signal Processing 50


Example

Compute the attenuation at 20 KHz for a digital audio system due to the
sin x x effect introduced by the D/A converter, if the sampling frequency is

(a) 44.1 kHz

(b) 176.4 kHz

5/16/23 Digital Signal Processing 51


Example
For fs = 44.1 kHz T= 1/44.1 x 103 = 22.68 µsec. When f = 20 kHz

(
H ( jw ) = H j 4p ´ 10 4
) =
( )
sin 4p ´ 10 4 ´ 22.68 ´ 10 -6 2
T = 0.694T
4p ´ 10 4 ´ 22.68 ´ 10 -6 2

Since H ( jw ) = T corresponds to zero attenuation, the attenuation at 20 kHz is

20 log10 0.694 = - 3.2 dB.

Similarly for fs = 176.4 kHz T= 1/176.4 x 103 = 5.669 µsec.

(
H ( jw ) = H j 4p ´ 10 4
) =
(
sin 4p ´ 10 4 ´ 5.669 ´ 10 -6 2)T = 0.979T
4p ´ 10 ´ 5.669 ´ 10 2
4 -6

20 log10 0.979 = - 0.2 dB.

5/16/23 Digital Signal Processing 52


Anti-Imaging Filters

Example signal level


(dB)
0.184 sin x
18
x

0 20 156.4 176.4
The analogue signal has a baseband that extends from dc to 20 kHz and the
DAC is updated at a rate of 176.4 kHz.

Image frequencies are to be suppressed by at least 50 dB and the signal


components are to be altered by a maximum of 0.5dB.

Determine the minimum values for the order and cut-off frequency for the anti-
image filter, assuming that it is a Butterworth characteristic

5/16/23 Digital Signal Processing 53


Example
Attenuation of the signal due to the sinx/x spectrum at the two critical
frequencies 20 kHz and 156.4 kHz is as follows.

sin x æ wT ö
@ 20 kHz = 0.9789 ç with x = ÷ = -0.184dB
x è 2 ø

sin x
@156.4 kHz = 0.125 = -18 dB
x

Thus in the passband the filter should not have more than 0.5-0.184
= 0.316 dB deviation

In the stop band an additional attenuation of 50-18 = 32 dB is required.

5/16/23 Digital Signal Processing 54


Example
This gives the following 2 equations:
[
20 log 1 + (20 f c ) ]
2n 1 2
£ 0.316 dB

20 log é1 + (156.4 f c ) ù 1 2 £ 32 dB
2n

ë û

solving these two simultaneous equations for n gives

n = 2.4 » 3 (integer) and fc = 30.76 kHz

5/16/23 Digital Signal Processing 55

You might also like