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

Digital Signal Processing Sampling

This document discusses sampling and data acquisition systems. It defines key terms like data acquisition, transducers, sensors, actuators, and sampling. It explains that data acquisition involves transforming physical phenomena into electrical signals using transducers, then measuring and converting the signals into a digital format. A data acquisition system consists of components that sense physical variables, condition electrical signals, convert signals to digital format, and process/store acquired data. The document also covers periodic sampling, the sampling theorem, analog to digital conversion, and whose theorem sampling actually is.

Uploaded by

syazo93
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
203 views

Digital Signal Processing Sampling

This document discusses sampling and data acquisition systems. It defines key terms like data acquisition, transducers, sensors, actuators, and sampling. It explains that data acquisition involves transforming physical phenomena into electrical signals using transducers, then measuring and converting the signals into a digital format. A data acquisition system consists of components that sense physical variables, condition electrical signals, convert signals to digital format, and process/store acquired data. The document also covers periodic sampling, the sampling theorem, analog to digital conversion, and whose theorem sampling actually is.

Uploaded by

syazo93
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 66

ECE3123 Digital Signal Processing

Session-II Sampling
Prof. Dr. Othman O. Khalifa
Khairul Azami Sidek
Electrical and Computer Engineering
Kulliyyah of Engineering
International Islamic University Malaysia

Remember :
Transducer

Data Acquisition and Recovery System

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

Data Recovery Filter

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 :

Transducers,sensors and Actuators

Transducer: A device which transforms energy


from one domain (magnetic, thermal,
mechanical, optical, chemical, electrical) into
another
Sensors: devices which monitor a parameter of
a system, hopefully without disturbing that
parameter.
Actuators: devices which impose a state on a
system, hopefully independent of the load
applied to them

Elements of
a data acquisition system
Transducers (Sensors, Actuators)
wiring
Signal conditioning
Data acquisition hardware
PC (operating system)
Data acquisition software

Human sensing and organs


Vision: eyes (optics, light)
Hearing: ears (acoustics, sound)
Touch: skin (mechanics, heat)
Odor: nose (vapor-phase chemistry)
Taste: tongue (liquid-phase
chemistry)

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.

output transducers (or actuators)


they convert an electrical signal into a non-electrical energy.
For example, a speaker.

Sensors and Actuators


Example of sensors
Magnetic sensors
Honeywells HMC/HMR magnetometers
Photo sensors
Clairex: CL9P4L
Temperature sensors
Panasonic ERT-J1VR103J
Accelerometers
Analog Devices: ADXL202JE
Motion sensors
Advantacas MIR sensors
"Without disturbing that parameter" implies that the sensors
must be small and low-power devices in order to reduce energy
exchange.
Sensors: devices which monitor a parameter of
a system, hopefully without disturbing that
parameter.

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

The process is referred to as pulse amplitude


modulation PAM and the outcome is a signal
with analog (non integer) values

Remember .

Signal Types

Analog signals: continuous in time and amplitude


Example: voltage, current, temperature,
Digital signals: discrete both in time and amplitude
Example: attendance of this class, digitizes
analog signals,
Discrete-time signal: discrete in time, continuous in
amplitude
Example: e.g. hourly change of temperature
In practice we mostly process digital signals on
processors
Need to take into account finite precision effects

Periodic (Uniform) Sampling


Sampling is a continuous to discrete-time conversion

Most common sampling is periodic

-3 -2 -1 0 1 2 3 4

x[n] = x c (nT ) < n <


T is the sampling period in second
fs = 1/T is the sampling frequency in Hz
Sampling frequency in radian-per-second s=2
fs rad/sec
Use [.] for discrete-time and (.) for continuous time signals
This is the ideal case not the practical but close enough
In practice it is implement with an analog-to-digital converters
We get digital signals that are quantized in amplitude and time

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

Fundamental issue in digital signal processing


If we loose information during sampling we cannot
recover it
Under certain conditions an analog signal can be sampled
without loss so that it can be reconstructed perfectly

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

Analog to Digital Conversion


ADC is an acronym for Analog to Digital Converter which
converts the analog signal x(t) into the digital signal
sequence x(n). Analog-to-digital conversion or
digitization consists of the sampling and quantization
processes. The sampling process depicts a
continuously varying analog signal as a sequence of
values. The quantization process approximates a
waveform by assigning an actual number for each
sample. An ADC consists of two fundamental blocks;
an ideal sampler and a quantizer.
A/D converter
Quantizer

Ideal Sampler
x(t)

x(nT)

x(n)

Analog to Digital Conversion


Analog-to-digital conversion carries out the following steps:
1. The bandlimited signal x(t) is sampled at uniformly spaced
instants of time , nT, where n is a positive integer, and T is the
sampling period in seconds. This sampling process converts an
analog signal into a discrete-time signal, x(nT), with
continuous amplitude value.
2. The amplitude of each discrete-time sample is quantized
into one of the 2B levels, where B is the number of bits the
ADC has to represent for each sample. The discrete amplitude
levels are represented (or encoded) into distinct binary words
x(n) with a fixed wordlength B. This binary sequence, x(n), is
the digital signal for DSP hardware.

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.

Whose theorem is this ?


The sampling theorem is usually known as the Shannon
Sampling Theorem due to Claude E. Shannons paper A
mathematical theory of communciation in 1948. The
minimum required sampling rate fs (i.e. 2xB) is known as
the Nyquist sampling rate or Nyquist frequency because of H.
Nyquists work on telegraph transmission in 1924 with K.
Kpfmller.
The first formulation of the sampling theorem precisely and
applied it to communication is probably a Russian scientist
by the name of V. A. Kotelnikov in 1933.
However, mathematician already knew about this in a
different form and called this the interpolation formula. E.
T. Whittaker published the paper On the functions which
are represented by the expansions of the interpolation
theory back in 1915!

Whose theorem is this ?...


The discovery of the sampling theorem is attributed
to Harry Nyquist and Claude Shannon. In 1928,
Nyquist referenced the existence of the theorem in his
paper, "Certain Topics in Telegraph Transmission
Theory," but he did not explicitly explore it. It
remains a mystery why Nyquist is considered one of
the founders of the principal, except for the fact that
the company he worked for--Bell Labs--referred to
the concept as the Nyquist Sampling Theorem in
their texts. In 1949, credit for the theorem was also
given to Shannon, a mathematical engineer, based on
the results outlined in his published work,
"Communication in the Presence of Noise." This
altered the official name to the Nyquist-Shannon
Sampling Theorem. This stick even though other
scientists--including E. T. Whittaker and V. A.
Kotelnikov--had published similar findings in 1915
and 1933 respectively.

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]

where fs is the sampling frequency (or sampling rate) in


hertz (Hz, or cycles per second).

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

1. The analog signal, x(t), must be bandlimited by


the bandwidth of the signal fM

2. The sampling frequency, fs, must be at least


twice the maximum frequency component fM in the
analog signal x(t). That is,

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:

This is only possible if the shaded parts do


not overlap. This means that fs must be more
than TWICE that of B.

What happens if we sample too slowly?


What are the effects of sampling a signal at,
above, and below the Nyquist rate? Consider a
signal bandlimited to 5Hz:

Sampling at Nyquist rate of 10Hz give:

What happens if we sample too slowly?


Sampling at higher than Nyquist rate at 20Hz
makes reconstruction much easier.

Sampling below Nyquist rate at 5Hz corrupts


the signal.
ALIASING

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

Anti-aliasing filter ,,,,


To avoid corruption of signal after sampling, one must ensure that
the signal being sampled at fs is bandlimited to a frequency B,
where B < fs/2.
Consider this signal spectrum:
After sampling:

After reconstruction:

Nyquist Sampling & Aliasing


Given a sequence
of number
representing a
sinusoidal signal,
the original
waveform of the
signal
(continuous-time
signal) cannot be
determined
Ambiguity caused
by spectral
replicating effect of
sampling

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.

Ideal Signal Reconstruction


Use ideal lowpass filter:

Thats why the sinc function is also known as the interpolation


function:

Practical Signal Reconstruction


Ideal reconstruction system is therefore:

In practice, we normally sample at higher frequency


than Nyquist rate:

Example of sample and


hold

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

Perfect reconstruction is not possible,


even if we use ideal low pass filter.

Limits of Human Hearing


20 Hz. < Human Hearing < 20 KHz.

Loudness is PERCEPTION related to POWER,


not AMPLITUDE

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

w1 = 1000, w2 = 1500, w3 = 2500


2. The Input frequencies are :
F1 = w1 / 2 = 500 Hz, F2 = w2 / 2 = 750 Hz, F3 = w3 / 2 =1250 Hz
3. Thus the Bandwidth Input signal is :
fmax = 1250 Hz or 1.25 kHz
4. Thus the signal should be sampled at
frequency more than twice the Bandwidth
Input Frequency,
F T > 2 fm
Thus the signal should be sampled at 2.5 kHz
in order to not lose the data. In other words, we need
more than 2500 samples per seconds in order to not lose the data

Example 2 :

The input continuous signal which have frequency of 2kHz enter


the DTS system and being sampled at every 0.1ms. Calculate the
digital and normalized frequency of the signal in Hz and rad.

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)]

Quantizing and Encoding


The fundamental distinction between discrete-time
signal processing and DSP is the wordlength. The
former assumes that discrete-time signals values x(nT)
have infinite wordlength while the latter assumes that
digital signal values x(n) only have a limited B-bit.
The quantizing and encoding process is a method of
representing the sampled discrete-time signal x(nT) as
a binary number that can be processed with DSP
hardware. To process or store the discrete-time signal
with DSP hardware, the signal must be quantized to a
digital signal x(n) with a finite number of bits. If the
wordlength of an ADC is B bits, there are 2B different
values (levels) that can be used to represent a sample.
Quantization is therefore a process that represents
an analog-valued sample x(nT) with its nearest level
that correspnds to the digital signal x(n).

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

Analysis of quantization errors

e[n] = x[n] x[n]


Quantization error
In general, for a quantizer with step size , the
quantization error satisfies that
/ 2 < e[n] / 2
when

( 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.

Analysis of quantization errors


Analyzing the quantization by introducing an error
source and linearizing the system:

The model is equivalent to quantizer if we know e[n].

Example of quantization error

original signal

3-bit quantization result

3-bit quantization error

Example of quantization error

8-bit quantization error

In a heuristic sense, the assumptions of the statistical


model appear to be valid if the signal is sufficiently
complex and the quantization steps are sufficiently
small, so that the amplitude of the signal is likely to
traverse many quantization steps from sample to
sample.

Quantization Noise

DT Signals: Quantization Error Computation

DT Signals: Quantization Error Computation

DT Signals: Quantization Error Computation

Quantization error analysis


The mean value of e[n] is zero, and its variance is
/2

1
e2 = e 2 de =

12
/ 2

Since

Xm
= B
2

For a (B+1)-bit quantizer with full-scale value Xm, the


noise variance, or power, is
2 B
2
2
X
m
e2 =
12

Quantization error analysis


A common measure of the amount of degradation of a
signal by additive noise is the signal-to-noise ratio (SNR),
defined as the ratio of signal variance (power) to noise
variance. Expressed in decibels (dB), the SNR of a (B+1)bit quantizer is

12 2 2 B x2
x2

SNR = 10 log10 2 = 10 log10


2
Xm

e
Xm

= 6.02 B + 10.8 20 log10


x
Hence, the SNR increases approximately 6dB for each bit
added to the world length of the quantized samples.

You might also like