Вы находитесь на странице: 1из 27

Quantization

Digital representations of analog signals are in the


form of bits. These bits are taken from an analog-to-
digital converter, processed and then put to a digital-
to-analog converter.
A/D
D/A
x
y
bits
Filtering
bits
What is the number of bits needed per sample to
accurately represent the analog signal?
With B bits, we can represent 2
B
different values.
For example, if B=3, we can have eight different
values corresponding to 000, 001, 010, 011, 100,
101, 110, 111.
The 2
B
values can correspond to volts, millivolts,
multiplies of 0.25 volts, etc.
Example: Suppose we had B=3 bits corresponding
to a number which is equal to the voltage of a signal
(at some point in time). The 2
3
=8 different voltage
levels are 0V, 1V, 2V, 3V, 4V, 5V, 6V and 7V.
An analog-to-digital converter would convert an input
signal at 0V to 000. An input of 1V would be
converted to 001; an input of 2V would be converted
to 010, etc.
A digital-to-analog converter would convert 000 to
0V, 001 to 1V, etc.
Suppose the input signal to an analog-to-digital
converter were 1.5V. Would this voltage be
converted to 001 or 010? The answer depends
upon the type of quantization used by the analog-
to-digital converter.
If the type of quantization is truncation, then all
values from 1.0V up to but not including 2.0V are
converted to 001.
If the type of quantization is rounding, then all
values from 0.5V up to but not including 1.5V are
converted to 001. Values of from 1.5V up to but not
including 2.5V are converted to 010.
Let x be the quantized version of x. While x can
take on any value, x can only take on discrete
values corresponding to the output of a digital-to-
analog converter such as 1.0, 2.0, 3.0 (volts).
^
^
If we cascade an analog-to-digital converter with a
digital-to-analog converter we will get a quantizer
that converts x to x.
^
A/D D/A
x x
^
000, 001,
The relationships between x and x are shown on the
following graphs.
^
Truncation
x
x
^
1 2 3 4 5 6 7 8
1
2
3
4
5
6
7
001
000
010
011
100
101
110
111
Rounding
x
x
^
1 2 3 4 5 6 7 8
1
2
3
4
5
6
7
Negative values can also be represented digitally.
There are two common formats: sign magnitude
and twos complement.
In sign magnitude format, the most significant bit is
a sign bit:1 is negative, 0 is positive.
In twos complement format, positive numbers are
like normal positive numbers. Negative numbers are
wrapped backwards: -1 is 111, -2 is 110, etc.
Shown on the following graphs are signed
quantization levels and values for truncation and
rounding quantization, and sign magnitude and twos
complement formats.
x
x
^
001
000
010
011
111
110
101
Truncation,
Sign Magnitude
x
x
^
001
000
010
011
100
101
110
111
Truncation,
Twos Complement
x
x
^
001
000
010
011
111
110
101
Rounding,
Sign Magnitude
x
x
^
001
000
010
011
100
101
110
111
Rounding,
Twos Complement
In all of the previous quantization examples, the step
size was one (1). The step size could be 0.5, 0.25,
etc. Let A be the step size, also known as the
quantization interval.
For truncation quantization, the quantization
error is between 0 and A.
For rounding quantization, the quantization error
is between -A/2 and +A/2.
The ratio of the maximum signal magnitude to the
quantization interval is a measure of the fidelity of
the digitized sample. Let us see if we can relate this
ratio to a more common ratio called the signal-to-
noise ratio (SNR).
Let A be the maximum magnitude of a signal. The
ratio of the maximum magnitude to the quantization
interval is A/A.
The signal-to-noise ratio is a ratio of powers. The
power in a signal is related to its distribution.
If the signal is uniformly distributed between A
and A, the distribution looks like this:
p
x
(x)
x
A -A
In many cases, we can assume that the distribution
of the quantization error, e, is uniform:
p
e
(e)
e
A
Truncation
In many cases, we can assume that the distribution
of the quantization error, e, is uniform:
p
e
(e)
e
A/2 -A/2
Rounding
The power may be obtained from a distribution by
integrating the product of the distribution with x
2
or
e
2
.

.
3 ) 2 ( 3
2
2
1
) (
2 3
2
2
A
A
A
dx
A
x
dx x p x P
A
A
x x
= =
=
=
}
}

.
3 ) ( 3
) (
1
) (
2 3
0
2
2
A
=
A
A
=
A
=
=
}
}
A
de e
de e p e P
e e
For truncation quantization we have
.
12 ) ( 3
) 2 / ( 2
1
) (
2 3
2 /
2 /
2
2
A
=
A
A
=
A
=
=
}
}
A
A
de e
de e p e P
e e
For rounding quantization we have
We can now calculate the signal-to-noise ratio for a
uniformly distributed signal with truncation and
rounding quantization:
e
x
P
P
SNR =
2
3
3
Truncation
2
2
|
.
|

\
|
A
= =
A
A
SNR
A
2
12
3
Rounding
4
2
2
|
.
|

\
|
A
= =
A
A
SNR
A
Exercise: If we use B-bit quantization (with 2
B

quantization levels), express the signal-to-noise ratio
in dB [=10 log (power ratio)] in terms of B for both
truncation and rounding quantization. (In both
cases, 2A/A = 2
B
.)

Вам также может понравиться