1
SBES152
Biomedical Signal
Processing
Lecture 02
Signal Sampling and Quantization
Shereen El-Metwally sh.elmetwally@eng1.cu.edu.eg
Credit: Adapted from slides by Dr. Muhammed
Rushdi
2
DSP General Scheme
The ADC unit samples the analog signal, quantizes
the sampled signal, and encodes the quantized
signal level to the digital signal.
3
Sampling Terminology
Sampling interval = T (or Ts)
Sampling frequency =
Or rad/sec
Sampling Terminology
Sample-and-hold analog
voltage for ADC.
4
Sampling Motivation
• Many of the real-world signals are analog.
Analog signals contain an infinite number of
points.
They cannot be processed by the digital
signal (DS) processor or computer: infinite
memory + infinite processing power.
• Sampling issues
Sampling in time + quantization in
amplitude
How to sample in time (sampling period)
Uniform Sampling
Continuous-time
signal xc(t) t
“Windowing”
Δ
As Δ 0
A very thin window
(impulse)
“Sampling”
Discrete -time
signal x[n]
-3 -2 -1 0 1 2 3 4 n
Uniform Sampling
Sampling is, in general, not reversible
1
0.5
-0.5
-1
0 20 40 60 80 100
Fundamental issue in digital signal processing
We don’t know what happens between samples.
If we lose 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
5
Uniform Sampling
• Sampling function
▫ Periodic sequence of impulses of
period Ts
• Sampled signal:
How would the sampled signal look like in the Frequency
Domain???
6
Uniform Sampling
•
7
Uniform Sampling
• Notice that Dk can be obtained by integration
over any period, say [-Ts/2, Ts/2]
Only one term
from the impulse
sequence lies
inside the
integration
interval
Sifting property of delta
function:
∫δ(t) f(t) dt = ∫δ(t) f(0) dt = f(0)
8
Uniform Sampling
Hint: Use the
properties of FT:
1. Linearity
2. Frequenc
y Shifting
1 δ(ω)
ejωot δ(ω - ωo )
Perio
d
= Ts
The Fourier transform of a periodic train of equidistant delta
functions in the
Uniform Sampling
Samples should be collected at a rate high enough that
the original analog signal can be reconstructed or
recovered later.
T = 0.01 or fs = 100 Hz
fs > 2
fmax
fs < 2 fmax
90 and 10 Hz signals are called “aliases” or indistinguishable of
14
How would the sampled signal
look like in the Frequency
mag
Domain??
Fourier Transform
t f (Hz)
“multiplication” x “convolution”
*
t
T f (Hz)
= fs = 1/T
mag =
-3 -2 -1 0 1 2 3 4 n f (Hz)
fs = 1/T
9
Uniform
Sampling
• Back to our question…
“The sampled signal in the frequency
domain”
Sampling
1
0
Sampling Rate Calculation
• Requirement: No Aliasing
allowed
1
1
Sampling Rate Calculation
Nyquist criterion
1
2
Sampling Rate Calculation:
Example
• The sampled signal can be
represented by:
where,
• Using Ts = 0.4,
1
3
Sampling Rate Calculation:
Example
• Is it periodic?
• What is the period?
New
• Draw using Matlab period
(how?):
Ts = 0.4 sec
1
4
Sampling Rate Calculation:
Example
•
2 >
Nyquist sampling condition is satisfied for T = 0.5, 0.4, and 0.2. But
it is not satisfied for T = 1.
1
5
Sampling Rate Calculation:
Example
T = 0.2 sec
s T = 0.4 sec
s
Ts = 0.5 sec Ts = 1 sec
1
6
Sampling Rate Calculation:
Example
Solution (a):
The signal is unit pulse.
Clearly, this signal can be easily sampled by
choosing any value of Ts << 1. ⇒
1
But, notice that 𝑢(𝑡 )❑
𝑗Ω
Sinc function has no maximum frequency! Not band-
limited! Thus, any chosen value of Ts will cause
aliasing.
1
7
Sampling Rate Calculation:
Example
Fortunately, the values of the sinc function go
fast to zero, so we can compute an approximate
maximum frequency that covers 99% of the
energy of the signal.
Using Parsval’s energy relation: The energy of
x1(t) is the area under x12(t)
This is difficult to calculate…. But can be
approximated.
1
8
Sampling Rate Calculation:
Example
Approximatin
g
a=0;
for k=0:0.001:20
a=a+0.001*sinc(0.5*k)
^2; if a>0.495
k
retur
n
en
d end
2
0
Reconstruction of the Original
Continuous-Time Signal from
Samples
• Assuming band-limited signal and sufficient
sampling, original signal can be recovered by low-
pass filtering.
2
1
Reconstruction of the Original
Continuous-Time Signal from
Samples
• Given,
• Then,
(1)
• Where,
(2)
• Substitute from (2) into (1),
xr(t)
Sinc-interpolation
Ideal Reconstruction Filter
Ideal LPF with cut off frequency of c= /T
(rad/sec) or fc=1/2T
sin ( 𝜋 𝑡 /𝑇 𝑠 )
h𝑟 (𝑡 )=
𝜋 𝑡 /𝑇 𝑠
29
Reconstructed Signal
sinc function is 1 at t=0
shifted sinc functions at nTs
∞
sin [ 𝜋 ( 𝑡 −𝑛𝑇𝑠 ) /𝑇𝑠 ]
𝑥𝑟 ( 𝑡 )= ∑ 𝑥 [ 𝑛𝑇 𝑠 ]
𝑛=− ∞ 𝜋 (𝑡 − 𝑛𝑇𝑠 ) /𝑇𝑠
The recovered signal is thus an “interpolation” in •
30
terms of time-shifted sinc signals with
2
3
Sampling of Infinite Bandwidth
Signals: Anti-Aliasing Filter
• Anti-aliasing filter: a low-pass filter applied to
the input signal to make sure that the signal to
be sampled has a limited bandwidth.
▫ Applied in all practical analog-to-digital
converters
2
4
Reconstruction of the Original
Continuous-Time Signal from
Samples
• In practice, the exact recovery of the original
signal may not be possible for several reasons:
▫ The continuous-time signal is not exactly band
limited, so there is no max. freq.
▫ The sampling is not done exactly at
uniform times— random variation of the
sampling times may occur.
▫ An ideal low-pass filter cannot be realized.
2
5
The Nyquist-Shannon Sampling
Theorem