Professional Documents
Culture Documents
Lecture 3
11 February 2020 2
Sampling
Sampling - Conversion of a continuous-time signal to discrete
time.
11 February 2020 3
Sampling
Sampling allows the use of
modern digital electronics to
process, record, transmit,
store, and retrieve C T
signals.
11 February 2020 5
Sampling
Every image that we see is sampled by the retina, which contains ≈ 100
million rods and 6 million cones (average spacing ≈ 3µm) which act as
discrete sensors.
11 February 2020 6
Analog signal to be digitized
This signal is a voltage that varies
over time;
We will assume that the voltage
can vary from 0 to 4.095 volts,
corresponding to the digital
numbers between 0 and 4095 that
will be produced by a 12 bit
digitizer;
11 February 2020 7
Sampling
Block diagram is broken into two sections, the sample-and-hold (S/H), and
the analog-to-digital converter (ADC).
The sample-and-hold is required to keep the voltage entering the ADC
constant while the conversion is taking place.
The output of the sample-and-hold is allowed to change only at periodic
intervals, at which time it is made identical to the instantaneous value of the
input signal. Changes in the input signal that occur between these sampling
times are completely ignored.
Sampled Digital output
Analog input analog
S/H signal ADC
Sampling converts the independent variable from continuous to
discrete.
11 February 2020 8
Quantization
11 February 2020 9
Effects of quantization
Any one sample in the digitized signal can have a maximum
error of ±½ LSB (Least Significant Bit, jargon for the distance
between adjacent quantization levels).
Figure (d) shows the quantization error for this particular
example, found by subtracting (b) from (c), with the appropriate
conversions.
The digital output (c), is equivalent to the continuous input (b),
plus a quantization error (d).
The quantization error appears very much like random noise.
11 February 2020 10
Quantization error
Quantization adds a specific amount of random noise to the
signal.
The additive noise is uniformly distributed between ±½ 𝐿𝑆𝐵,
has a mean of zero, and a standard deviation of 1/12 LSB
(0.29 𝐿𝑆𝐵).
8 bit digitizer adds an rms noise of: 0.29 /256 1/900 of the full
scale value.
12 bit conversion adds a noise of: 0.29 /4096 1 /14000 of the
full scale value
16 bit conversion adds: 0.29 /65536 1 /227000 of the full scale
value
Number of bits determines the precision of the data !
11 February 2020 11
Quantization error
When the analog signal remains at about the same value for
many consecutive samples, then model of quantization isn’t valid!
The output remains
stuck on the same digital
number for many samples in a
row, even though
the analog signal may be
changing up to ±½ LSB
Instead of being an
additive random noise, the
quantization error now looks
like a thresholding
effect or weird distortion
11 February 2020 12
Dithering
Dithering is a common technique for improving the digitization of
these slowly varying signals.
A small amount of random noise is added to the analog signal.
The added noise is normally distributed with a standard deviation of
2/3 LSB, resulting in a peak-to-peak amplitude of about 3 LSB.
11 February 2020 13
Dithering
Subtractive Dither -
• using a computer to generate random numbers;
• passing them through a DAC to produce the added noise;
• after digitization, the computer can subtract the random numbers
from the digital signal using floating point arithmetic.
Proper sampling.
11 February 2020 15
Sampling
Sine has a frequency of 0.09 of the
sampling rate.
90 cycle/second sine wave being
sampled at 1000 samples/second.
There are 11.1 samples taken over
each complete cycle of the sinusoid.
11 February 2020 16
Sampling
The sine wave's frequency is 0.31
of the sampling rate.
only 3.2 samples per sine wave
cycle.
11 February 2020 17
Sampling
The sine wave's frequency is 0.95
of the sampling rate.
only 1.05 samples per sine wave
cycle.
The samples represent a
different sine wave.
The original sine wave of 0.95
frequency misrepresents itself as
a sine wave of 0.05 frequency in
the digital signal.
This phenomenon of sinusoids
changing frequency during
Improper sampling
sampling
11 February 2020
is called aliasing. 18
Aliasing
Suppose we have a sinusoidal signal 𝑥 𝑡 = cos 2𝜋800𝑡 . When we sampled it, we replaced t
in the continuous signal 𝑥(𝑡) with regularly spaced time points 𝑛𝑇𝑠
𝑥 𝑛 = 𝑥 𝑛𝑇𝑠
Suppose that we sample this 800 Hz sinusoid at 𝑓𝑠 = 600 samples/second. Sampled signal is:
𝑥 𝑡 = cos 2𝜋800𝑡
𝑥 𝑛 = cos 2𝜋800𝑛𝑇𝑠
𝑥 𝑛 = cos 2𝜋 200 + 600 𝑛𝑇𝑠
𝑥 𝑛 = cos 2𝜋200𝑛𝑇𝑠 + 2𝜋600𝑛𝑇𝑠
1 1
𝑇𝑠 = , 𝑠𝑜 𝑇𝑠 = . We will replace this in the right-most term.
𝑓𝑠 600
1
𝑥 𝑛 = cos 2𝜋200𝑛𝑇𝑠 + 2𝜋600𝑛
600
𝑥 𝑛 = cos 2𝜋200𝑛𝑇𝑠 + 2𝜋𝑛
The cosine function is periodic with period 2𝜋. That is why we will obtain
𝑥 𝑛 = cos 2𝜋200𝑛𝑇𝑠 .
When we sample a 800 Hz sinusoid at 600 samples/second, we cannot distinguish it from a
200 Hz sinusoid. It is called aliasing.
11 February 2020 19
Sampling Theorem
Shannon sampling theorem Nyquist sampling theorem
11 February 2020 20
Nyquist frequency and Nyquist rate
Nyquist frequency/rate is one-half the sampling rate.
Consider an analog signal composed of frequencies between DC
and 3 kHz.
To properly digitize this signal it must be sampled at 6,000
samples/sec (6 kHz) or higher. Suppose we choose to sample at
8,000 samples/sec (8 kHz), allowing frequencies between DC and
4kHz to be properly represented.
11 February 2020 23
Impulse Train
Impulse train is a continuous signal
consisting of a series of narrow spikes
(impulses) that match the original signal at
the sampling instants.
11 February 2020 24
Signal spectra
Sampling the signal in (a) by using an impulse train produces the signal
shown in (c), and its frequency spectrum shown in (d). This spectrum is a
duplication of the spectrum of the original signal. Each multiple of the
sampling frequency, fs, 2fs, 3fs, 4fs, etc., has received a copy and a left-
forright flipped copy of the original frequency spectrum. The copy is called
11the upper
February 2020 sideband, while the flipped copy is called the lower sideband. 26
Signal spectra
Figure (e) shows an example of improper sampling, resulting from too low of
sampling rate. The analog signal still contains frequencies up to 3.3 kHz, but
the sampling rate has been lowered to 5 kHz.
11 February 2020 28
Overlapping problem
The frequency spectrum, (f), shows the problem: the duplicated portions of the
spectrum have invaded the band between 0 and ½ of the sampling frequency.
Although (f) shows these overlapping frequencies as retaining their separate identity,
in actual practice they add together forming a single confused mess. Since there
is no way to separate the overlapping frequencies, information is lost, and the
original signal cannot be reconstructed.
11 February 2020 29
Digital-to-Analog Conversion
The simplest method for digital-to-analog conversion is to pull the samples from
memory and convert them into an impulse train.
The original analog signal can be perfectly reconstructed by passing this
impulse train through a low-pass filter, with the cutoff frequency equal to ½ of
the sampling rate.
The original signal and the impulse train have identical frequency spectra
below the Nyquist frequency (½ the sampling rate). At higher frequencies, the
impulse train contains a duplication of this information.
11 February 2020 30
Digital-to-Analog Conversion
it is difficult to generate the required narrow pulses in electronics. Nearly all DACs
operate by holding the last value until another sample is received. This is called a
zeroth-order hold, the DAC equivalent of the sample-and-hold used during
ADC. The zeroth-order hold produces the staircase appearance shown in (c).
11 February 2020 31
Digital-to-Analog Conversion
In the frequency domain, the zeroth-order hold results in the spectrum of the
impulse train being multiplied by the dark curve shown in (d), given by the
equation: