You are on page 1of 20

ELEC1010 Tutorial 6

Digitization
 Sampling
 Quantization
Digitization
 Digital Signal: a set of sampled values in binary form as
bits.
 Two main operations for digitization
1. Sampling:
 Convert an analog signal into a list of numbers

 Each number is one sample


x(t) ADC xd[n]
x(t )  x[n] samples Digital words

2. Quantization: ADC: analog-to-digital converter

• Put the samples into binary format (bits)


x[ n ]  x d [ n ]
2
Sampling
 A process of recording samples of a signal at distinct
point in time or space.
 Audio – time

 Image – space

 Video – time & space

 Sampled at uniformly spaced time instants


 Sampled at uniformly spatial intervals

3
Sampling
Sampling Period & Sampling Rate
 Sampling Period Ts: spacing in time between two
adjacent samples

 Sampling Rate/Sampling frequency fs


 Number of samples/second

 fs = 1/ Ts

4
Sampling

Nyquist Sampling Theorem

Harry Nyquist, Bell Laboratories engineer and physicist

Nyquist theorem: A sampled signal can be converted


back to its original analog signal without any error, if
the sampling rate is more than twice as large as the
highest frequency of the signal.

5
Why more than twice as large as the highest frequency
of the signal? Let’s analyze the borderline:
 What if the fs = 2f
sampling was done when the
sinusoid has zero values ?
Problem: We cannot distinguish between the original sinusoid and
signal that is always 0!
T=2Ts
 What if two sine waves with
same period T are sampled at fs =
2f with these same set of samples?
Problem:
We cannot uniquely determine the amplitude of the 2 signals.
6
Sampling
 Nyquist rate fs=2×fhighest is the borderline
 The minimum sampling rate must be greater than 2

samples per period.


 A sine wave cannot turn more than once between two

adjacent samples.
Minimum
Signal type Signal bandwidth Actual sampling rate
sampling rate
Telephone-quality speech 3.5 kHz 7000 samples/s 8000 samples/s

Music 20 kHz 40,000 samples/s 44,100 samples/s


FM radio 200 kHz 400,000 samples/s 500,000 samples/s
Analog TV 6 MHz 12,000,000 samples/s 14,400,000 samples/s

These are the sample rates at which a digital FM radio and digital TV processer have to
operate at in order to process these signals digitally.
7
Exercise 1
Suppose we sample the signal S t   sin(2 10t )  5 sin(2 20t )  3 sin(2 30t ) .
Among the following choices, which one allows us to recover
exactly, but with the lowest sampling frequency?

A. Sampling frequency 9 Hz.


B. Sampling frequency 35 Hz
C. Sampling frequency 42 Hz
D. Sampling frequency 62 Hz
E. Sampling frequency 124 Hz

Answer: D (Nyquist rate fs = 2 x 30 = 60)

8
Exercise 2
Suppose we sample the signal S t   sin(2 10t )  5 sin(2 20t )  3 sin(2 30t )
at 2 times the Nyquist sampling rate. How many samples will be
produced in one period?

A. 2.
B. 4
C. 12
D. 20
E. 120

Answer: C
3rd harmonic has frequency 3f (f = 1/T)
Nyquist rate fs = 2 (3f) = 6f => 6 samples in one period T.
2 x Nyquist rate = 2 x 6 = 12 samples in one period.
9
Exercise 3
We perform sampling on an audio signal which is composed of its 1st
and 3rd harmonics. The amplitude of the signal’s 1st harmonic is 1; the
amplitude of the signal’s 3rd harmonic is also 1. The time domain
representation of the audio signal (red curve) with its samples (blue
dots) is shown below:

10
i. What is the sampling rate?

Answer:
fs = 12 Hz = 12 samples/second

11
ii. Does the sampling rate allow us recover the original signal without
any error? If yes, why? If no, suggest a sampling rate that allows us to
recover the original signal exactly.

Answer:
No. Because the signal turn twice between two adjacent samples.
(Alternative explanation: T = 1/3 = 0.33s => f = 3Hz
3rd harmonic (3f) = 9Hz => Nyquist rate = 18 Hz, 12Hz < 18 Hz).

The sampling frequency should be larger than 18 Hz, e.g. 19Hz.


12
iii. If we perform sampling with sampling rate as large as 1.5 times
the Nyquist rate, what is the sampling rate?

Answer:
3rd harmonic (3f) = 9Hz
fs = 1.5 Nyquist rate = 1.5×( 2 × 9) = 27 Hz

13
Quantization

 Put samples into binary format (bits).

 Make samples discrete in values

 Two steps:
 Divide the data range into a finite number of levels.
(Use binary digits to represent each level)
 Round the true value to the nearest level. (Signal
Rounding)
14
Quantization
N bits gives 2N quantization levels
An N-bit number runs from 0 to 2N – 1, which consists
of 2N levels in total.
e.g.
for a 5-bit number, the smallest number is 00000, and the
largest number is 11111.
00000=0
11111=25-1
There are 25=32 levels

The reproduced value is the middle of the signal level range. See next slide.
Quantization error = │actual analog value – reproduced value│
15
Quantization - 2 bit Quantizer
x(nTs) ADC xd(n)
Reproduced
analog values levels bits analog values
1 1.00
3 => 11 0.875V
0.75
2 => 10 0.625V
0.50
1 => 01 0.375V
0.25
0 => 00 0.125V
0 0.00
• Analog range = 0V to 1V
• Digital Level = 0, 1, 2, 3
• Binary digital representation = 00, 01, 10, 11 How about 0.25??
• e.g. 0.8V is in level 3, converted to 11 (Binary) (00 or 01)
0.2V is in level 0, converted to 00
The bit sequence produced by 0.8V and 0.2V is 1100
The reproduced analog values for 1100 will be: 0.875V followed by 0.125V.

16
For 11: 0.8V is rounded to 0.875V. Quantization error =|0.8 – 0.875|= 0.075V
Quantization - 3 bit Quantizer
1.Using 3-bit uniform quantization on the signal amplitude from -4 to 4
inclusively, construct the “analog-to-digital” conversion map.
2. A segment of an audio signal in the time domain is shown below.
Determine the sequence of bits that will be generated by the ADC for
the first four samples.
3. What is the quantization error for each of the first four samples?

17
Quantization - 3 bit Quantizer Answer
1. Analog values levels bits Reproduced value
4
3 ≤ data ≤ 4 7 111 3.5
3
2 ≤ data ≤ 3 6 110 2.5
2
1 ≤ data ≤ 2 5 101 1.5
1
0 ≤ data ≤ 1 4 100 0.5
0
– 1 ≤ data ≤ 0 3 011 – 0.5
–1
– 2 ≤ data ≤ – 1 2 010 – 1.5
–2
– 3 ≤ data ≤ – 2 1 001 – 2.5
–3
– 4 ≤ data ≤ – 3 0 000 – 3.5
–4
18
Quantization - 3 bit Quantizer Answer
2. 0: 100 or 011
3.16: 111 (sequence bit)
-2.35: 001
-0.95: 011
The bit sequence is 100111001011 or 011111001011
3. 100: 0.5 (or 011: -0.5)
111: 3.5 (reproduced value)
001: -2.5
011: -0.5
|0 – 0.5| = 0.5
|3.16 – 3.5| = 0.34 (quantization error)
|-2.35 – (-2.5)| = 0.15
|-0.95 – (-0.5)| = 0.45
Quantization error is the absolute difference between the actual
analog value and the reproduced value.
19
Exercise 4
Consider the following three processed signals from the same audio
signal: Signal (i), Signal (ii) and Signal (iii).
By examining the signal plots, determine which of the following
statements is correct?

A. Signal (i) has less quantization levels than signal (iii).


B. Signal (i) has more quantization levels than signal (iii).
C. Signal (i) has lower sampling frequency than signal (ii).
D. None of the above

Answer: B
20

You might also like