Digital Signal Processing Sampling
Digital Signal Processing Sampling
Session-II Sampling
Prof. Dr. Othman O. Khalifa
Khairul Azami Sidek
Electrical and Computer Engineering
Kulliyyah of Engineering
International Islamic University Malaysia
Remember :
Transducer
Amplifier
Analog
Input
Signal
Anti-Alaising
Filter
Additional
Analog
Signals
A/D
Converter
Analog
Multiplexor
Sample
& Hold
Quantizer
Program
Sequencer
Analog
Output
Signal
uP
Control
Amplifier
D/A Converter
Coder
Digital
Output
Signal
Definitions
Data acquisition is the process by which physical
phenomena from the real world are transformed into
electrical signals that are measured and converted into a
digital format for processing, analysis, and storage by a
computer.
Data acquisition (DAQ) system is designed not only to
acquire data, but to act on it as well.
A data acquisition system consists of many
components that are integrated to:
Sense physical variables (use of transducers)
Condition the electrical signal to make it readable by
an A/D board
Convert the signal into a digital format acceptable by
a computer
Process, analyze, store, and display the acquired data
with the help of software
Definitions :
Elements of
a data acquisition system
Transducers (Sensors, Actuators)
wiring
Signal conditioning
Data acquisition hardware
PC (operating system)
Data acquisition software
Transducers
Sense physical phenomena and
translate it into electric signal.
Temperature
Pressure
Light
Force
Displacement
Level
Electric signals
ON/OFF switch
Transducers
A transducer is a device that converts energy
from one form to another.
In signal processing applications, the purpose of
energy conversion is to transfer information, not
to transform energy.
In physiological measurement systems,
transducers may be
input transducers (or sensors)
they convert a non-electrical energy into an electrical signal.
for example, a microphone.
Sampling
The process of converting a continuous-time signal to
a sequence of numbers is called Sampling
In general, ADC consists of four steps to digitize an
analog signal:
1.
Filtering
2.
Sampling
3.
Quantization
4.
Binary encoding
Before we sample, we have to filter the signal to limit
the maximum frequency of the signal as it affects the
sampling rate.
Filtering should ensure that we do not distort the
signal, ie remove high frequency components that
affect the signal shape
Basic ADC
Sampling
Analog signal is sampled every TS secs.
Ts is referred to as the sampling interval.
fs = 1/Ts is called the sampling rate or
sampling frequency.
There are 3 sampling methods:
Ideal - an impulse at each sampling instant
Natural - a pulse of short width with varying
amplitude
Flattop - sample and hold, like natural but with
single amplitude value
Remember .
Signal Types
-3 -2 -1 0 1 2 3 4
Periodic Sampling
Sampling is, in general, not reversible
Given a sampled signal one could fit infinite continuous signals
through the samples
1
0.5
0
-0.5
-1
0
20
40
60
80
100
Representation of Sampling
Mathematically convenient to represent in two stages
Impulse train modulator
Conversion of impulse train to a sequence
s(t)
xc(t)
Convert
impulse train
to discrete-time
sequence
xc(t)
x[n]=xc(nT)
x[n]
s(t)
n
t
-3T-2T-T 0 T 2T3T4T
-3 -2 -1 0 1 2 3 4
Ideal Sampler
x(t)
x(nT)
x(n)
Sampling Process
Use A-to-D converters to turn x(t) into numbers
x[n]
Take a sample every sampling period Ts uniform
sampling
Continuous-
x(t)
time to
Discrete-time
x[n]
x[n]=x(nTs)
fs=2 kHz
f=100 Hz
fs=500 Hz
Sampling Theorem
Bridge between continuous-time and discrete-time
Tell us HOW OFTEN WE MUST SAMPLE in order not to loose any
information
Sampling Theorem
A continuous-time signal x(t) with frequencies no higher than
fmax (Hz) can be reconstructed EXACTLY from its samples x[n]
= x(nTs), if the samples are taken at a rate fs = 1/Ts that is
greater than 2fmax.
For example, the sinewave on previous slide is 100 Hz. We need to
sample this at higher than 200 Hz (i.e. 200 samples per second) in order
NOT to loose any data, i.e. to be able to reconstruct the 100 Hz sinewave
exactly.
fmax refers to the maximum frequency component in the signal that has
significant energy.
Consequence of violating sampling theorem is corruption of the signal
in digital form.
Sampling
An ideal sampler can be considered as a switch that is, it
is periodically open and closed every T seconds which is
expressed as:
x[n] = xa (t ) t = nT = xa (nT )
xa(t)
x[n]
Sampling
In order to represent an analog signal x(t) by a
discrete-time signal x(nT) accurately, the following
conditions must be met:
Shannons sampling theorem
Sampling
Shannons Sampling Theorem: This states that when
the sampling frequency is greater than twice the
highest frequency component contained in the analog
signal, the original signal x(t) can be perfectly
reconstructed from the discrete signal x(nT).
The minimum sampling frequency fs=2fM is the
Nyquist rate while fN= fs / 2 is the Nyquist frequency
(or folding frequency). The frequency interval [
fs / 2,
fs / 2] is called the Nyquist interval.
When an analog signal is sampled at sampling
frequency, fs, frequency components higher than fs / 2
fold back into the sampling range [0, fs / 2]. This
undesired effect is known as aliasing. An anti-aliasing
filter is an analog lowpass filter with the cut-off
frequency of
Sampling
The intermediate signal, x(nT), is a discrete-time
signal with a continuous value (a number has infinite
precision) at discrete time nT, n = 0, 1, , as
illustrated in the figure below. The signal x(nT) is an
impulse train with values equal to the amplitude of x(t)
at time nT. The analog input signal x(t) is continuous in
both time and amplitude while the sampled signal x(nT)
is continuous in amplitude, but defined only at discrete
points in time. Thus the signal is zero except at
sampling instants t = nT.
x(nT)
2T
3T
4T
Time, t
Sampling proof
Therefore, to reconstruct the original signal
x(t), we can use an ideal lowpass filter on the
sampled spectrum:
Anti-aliasing filter
Anti-aliasing filter
To prevent aliasing effect
A low-pass analog filter with cut-off
frequency less than half of sampling
frequency
Pre-filtering to ensure all frequency
components outside band-limited
signal sufficiently attenuated
After reconstruction:
Practical Sampling
Impulse train is not a very practical sampling
signal. Let us consider a train of pulses pT(t) of
pulse width t=0.025 sec.
Signal Reconstruction
First, the digitally
processed data y(n)
are converted to the
ideal impulse train
ys(t), in which each
impulse
has
its
amplitude
proportional to digital
output y(n), and two
consecutive impulses
are separated by a
sampling period of T;
second, the analog
reconstruction filter is
applied to the ideally
recovered
sampled
signal ys(t) to obtain
the recovered analog
signal.
Signal Reconstruction
Signal Reconstruction
Aliasing
Sampling as a summary
terminology:
sampling frequency/rate fs
Nyquist frequency fs/2
sampling interval/period Ts
e.g. CD audio: fmax 20 kHz ) fs = 44,1 kHz
anti-aliasing prefilters:
if
then frequencies above the Nyquist frequency will be
folded back to lower frequencies
= aliasing
to avoid aliasing, the sampling operation is usually preceded by a low-pass antialiasing filter
. oversampling:
it is possible to make a trade-off between sampling rate and quantization noise
using a coarse quantizer may be compensated by sampling at a higher rate =
oversampling
Example 1 :
If the analog signal is in the form of :
xa[t] = 3cos(1000t-0.1)- 2cos(1500t+0.6) +
5cos(2500t+0.2)
Determine the signal bandwidth and how fast
to sample the signal without losing data ?
Solution :
1. There are 3 frequencies components in the signal which is
Example 2 :
Solution :
1. Calculate the Sampling Rate :
FT = 1 / T = 1 / (0.1ms) = 10 kHz.
2. Now, calculate the digital frequency.
f = F / FT = 2 kHz / 10 kHz = 0.2
3. The digital frequency in radian,
= 2f = 2 (0.2) = 0.4 rad.
4. The normalized digital frequency in radian,
= T = 2FT = 2(2kHz)(0.1ms) = 0.4.
Example :
The analog signal that enters the DTS is in the form of :
xa[t] = 3cos(50t) + 10sin(300t) - cos(100t)
a. Determine the input signal bandwidth.
b. Determine the Nyquist rate for the signal.
c. Determine the minimum sampling rate required to
avoid aliasing.
d. Determine the digital (discrete) frequency after
being sampled at sampling rate determined from c.
e. Determine the discrete signal obtained after DTS.
Solutions :
a. The frequencies existing in the signals are :
F1 = w1 / 2 = 50 / 2 = 25 Hz.
F2 = w2 / 2 = 300 / 2 = 150 Hz.
F3 = w3 / 2 = 100 / 2 = 50 Hz.
f m = Maximum input frequency = 150 Hz.
b. The Nyquist rate is defined as :
2 f m = f T = 2(150 Hz) = 300 Hz.
c. The minimum sampling rate required to avoid aliasing is
f T 2 f m = 300 Hz.
d. f1 = F1 / FT = 25 Hz / 300 Hz = 1/12
f2 = F2 / FT = 150 Hz / 300 Hz = 1/2
f3 = F3 / FT = 50 Hz / 300 Hz = 1/6
e. The discrete signal after DTS is :
x[n] = xa[nTs] = 3cos[2n(1/12)] + 10sin[2n(1/2)]- cos[2n(1/6)]
Quantizer (Quantization)
The real-valued signal has to be stored as a code for
digital processing. This step is called quantization.
x[n] = Q( x[n])
Quantization
Sampling results in a series of pulses of varying
amplitude values ranging between two limits: a
min and a max.
The amplitude values are infinite between the
two limits.
We need to map the infinite amplitude values
onto a finite set of known values.
This is achieved by dividing the distance
between min and max into L levels, each of
height .
= (max - min)/L
Quantization
L: No. of quantization level
m: Number of bits in ADC
: Step size of quantizer
i: Index corresponding to binary code
xq: Quantization level
xmax: Max value of analog signal
xmin: Min value of analog signal
Example:
Unipolar
Quantization levels
Assume we have a voltage signal with
amplitutes Vmin=-20V and Vmax=+20V.
We want to use L=8 quantization levels.
Zone width = (20 - -20)/8 = 5
The 8 zones are: -20 to -15, -15 to -10, -10
to -5, -5 to 0, 0 to +5, +5 to +10, +10 to +15,
+15 to +20
The midpoints are: -17.5, -12.5, -7.5, -2.5,
2.5, 7.5, 12.5, 17.5
Quantization contd.
Bipolar
Example 4
Problem:
Solution:
c.
a.
b.
d.
101
Quantization error:
Quantization
Quantization
Introduces
Noise
( X m / 2) < x[n] ( X m / 2)
If x[n] is outside this range, then the quantization
error is larger in magnitude than /2, and such
samples are saided to be clipped.
original signal
Quantization Noise
1
e2 = e 2 de =
12
/ 2
Since
Xm
= B
2
12 2 2 B x2
x2
e
Xm