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

DSP practical implementation

Sample and Hold


Sample and Hold
A/D Converter
Time and Frequency Domain
Discrete-Time Signal
Discrete-Time Signal
Discrete-Time Signal

-The rate of oscillation of a discrete-time sinusoid increases as


ω increases from ω = 0 to ω = π.

-However, as ω increases from ω = π to ω= 2π, the oscillations


become slower.

- Therefore, low-frequencies (slow oscillations) are at the


vicinity of ω = k2π and high-frequencies (rapid oscillations) at
the vicinity of ω = π +k2π.
Discrete-Time Signal
Discrete-Time Signal
Discrete-Time Signal
Discrete-Time Signal
Discrete-Time Signal
Discrete-Time Signal
1. Sinusoidal sequences with radian frequencies separated by
integer multiples of 2π are identical.

2. All distinct sinusoidal sequences have frequencies within an


interval of 2π radians. We shall use the so-called fundamental
frequency ranges −π < ω ≤ π or 0 ≤ ω < 2π.

Therefore, if 0 ≤ ω < 2π, the frequencies ω and ω+ m2π are


indistinguishable from observation of the corresponding
sequences.
Discrete-Time Signal
Discrete-Time Signal

Plot of the DTFS of the sinusoidal sequence x[n] = cos(2π(2/5)n)


Discrete-Time Signal
The sequence x[n] = A cos(2πfn) is periodic if and only if f = k/N,

that is, f is a rational number. If k and N are a pair of prime


numbers, then N is the fundamental period of x[n].
Discrete-Time Signal
Determine whether or not each of the following signals is
periodic. If a signal is periodic, determine its fundamental
period:

(a) x2[n] = 4 cos(0.1πn)

(b) x4[n] = 2 cos(n/11)


Discrete-Time Signal
(a)

(b)
Discrete-Time Signal

Consider the continuous-time signal x(t) = cos(15πt), −∞ < t < ∞.

(a) Determine the sampling period T such that the sequence


x[n] = x(nT) is periodic.

(b) Find the fundamental period of the sequence x[n] if T = 0.1 s.


Discrete-Time Signal
Aliasing
Aliasing
Aliasing
Aliasing
Quantization
• The importance of digital signals stems from the
proliferation of high-speed digital computers for signal
processing.
• Due to the finite memory limitations of machines, finite
data sequences can be processed only.
• An analog signal must not only be sampled in time but
also quantize (round or truncate) the signal amplitudes
to a finite set of values.
• Since quantization affects only the signal amplitude,
both analog & discrete-time signals can be quantized.

26
Quantization
• Quantized discrete-time signals are called digital
signals.
• Each quantized sample is represented as a group of
zeros and ones (bits).
• The finer the quantization, the longer the word.
• Like sampling, improper quantization leads to loss of
information.
• Quantization always introduces some noise, whose
effects can be described only in statistical terms

27
Uniform Quantizers
• Quantizers are devices that operate on a signal to
produce a finite number of amplitude levels or
quantization levels.
• It is common practice to use uniform quantizers with
equal quantization levels.
• The number of levels L in most quantizers used in ADC
is invariably a power of 2.
• If L = 2B, each of the L levels is coded to a binary
number & each signal value is represented in binary
form as a B-bit word corresponding to its quantized
value

28
Uniform Quantizers
• A 4-bit quantizer is thus capable of 24 (or 16)
levels and a 12-bit quantizer yields 212 (or
4096) levels. A signal may be quantized by:
– truncation to a level smaller than the next
higher one,
– rounding to the nearest quantization level, or
– sign-magnitude truncation, which is rather like
truncating smaller absolute values and the using
the appropriate sign
Various ways of quantizing a signal

30
Example 3.5
Let consider the following discrete-time signal

0.9 , n  0
n

xn  
 0 , n0

31
Solution
• Obtained by sampling the analog exponential
signal x t   0.9 t , t  0 with a sampling
frequency, f = 1Hz.

32
33
Numerical Illustration of Quantization with One Significant
Digit Using Truncation or Rounding
x[n] xq[n] xq[n]
n
Discrete-time signal (Truncation) (Rounding)
0 1 1.0 1.0
1 0.9 0.9 0.9
2 0.81 0.8 0.8
3 0.792 0.7 0.8
4 0.6561 0.6 0.7
5 0.59049 0.5 0.6
6 0.531441 0.5 0.5
7 0.4782969 0.4 0.5
8 0.43046721 0.4 0.4
9 0.387420489 0.3 0.4
34
• The observed value may be set to the full-
scale value (saturation) or zero (zeroing),
leading to the overflow characteristics
Observed Value Observed Value

V V
-V V -V V
Actual Actual Value
Value
-V -V
Saturation Zeroing
35
Various Number Representations for B
= 3 bits
Decimal Sign and One’s Two’s Offset
value Magnitude complement complement Binary
+4 111
+3 011 011 011 110
+2 010 010 010 101
+1 001 001 001 100
+0 000 000 000
-0 100 111 011
-1 101 110 111 010
-2 110 101 110 001
-3 111 100 101 000
-4 100

36
Various Number Representations for
B = 4 bits
Integer Sign- magnitude One's complement Two's complement Offset binary

+7 0111 0111 0111 1111


+6 0110 0110 0110 1110
+5 0101 0101 0101 1101
+4 0100 0100 0100 1100
+3 0011 0011 0011 1011
+2 0010 0010 0010 1010
+1 0001 0001 0001 1001
0 0000 0000 0000 1000
-1 1001 1110 1111 0111
-2 1010 1101 1110 0110
-3 1011 1100 1101 0101
-4 1100 1011 1100 0100
-5 1101 1010 1011 0011
-6 1110 1001 1010 0010
-7 1111 1000 1001 0001
-8 - - 1000 0000
-0 1000 1111 - -

37
Example
• An analog signal 𝑥 𝑡 = 2 sin 4𝜋𝑡 v is
sampled at a sampling rate of 13 Hz. The
signal is then will be quantized and encoded
into 4 bits code words. Find the discrete
signal, the quantized signal (rounding and
truncation) and encoded output signal if the
quantizer dynamic range is from -2V to +2V for
the first 5 samples only.

All right reserved. Copyright ©


38
2011. Sharifah Saon
Quantization Error and Quantization
Noise
• The quantization error depends on the
number of levels.
• If the quantized signal corresponding to a
discrete signal x[n] is denoted by xQ[n], the
quantization error ε[n] equals

ε[n] = x[n] - xQ[n]

39
• The quantization signal-to-noise ratio
(SNRQ) is defined as the ratio of the power PS
in the signal & the power PN in the error ε[n]
(or noise).
• Measured in dB
1 N 1 2 1 N 1 2
PS   x n PN    n
N n 0 N n 0

SNRQ dB   10 log 10


PS
 10 log 10
 n
x 2

PN  n
 2

40
• The dynamic range or full-scale range of a
signal x(t) is defined as its maximum
variation
D = xmax – xmin.
• If x(t) is sampled and quantized to L levels
using a quantizer with a full-scale range of D,
the quantization step size or resolution, ,
is defined as
Δ = D/L
41
• Step size corresponds to the LSB.
• The dynamic range of a quantizer is expressed in dB.
• For a 16-bit quantizer, the dynamic range is
20 log 216 ≈ 96 dB.
• For quantization by rounding, the maximum value of
the quantization error must lie between –Δ/2 and Δ/2.
• If L is large, the error is likely to take on any value
between –Δ/2 and Δ/2

42
• Probability density function f(ε) of a signal
quantized by rounding

f(ε)
Δ/2

–Δ/2 Δ/2

43
• The noise power PN equals its variance σ2 & is
given by
2 1 2 2 
2
PN      f  d    d 
2 2
 2   2 12

• The rms quantization error is defined as




12

• With Δ = D/L, some


D 2 computation can be done:
10 log PN  10 log 2
 20 log D  20 log L  10.8
12 L
44
• A statistical estimate of the SNR in dB is given by:
SNRS(dB) = 10logPS - 10logPN
= 10logPS + 10.8 + 20logL - 20logD

• For a B-bit quantizer with L = 2B levels, the statistical


estimates is given by
SNRS(dB) = 10logPS + 10.8 + 6B - 20logD

45
Example 3.6
A sampled signal that varies between -2 V and
2 V is quantized using B bits. What value of B
will ensure an rms quantization error of less
than 5 mV?

46
Solution
The full-scale range is D = 4 V. The rms
quantization error is given by
D
 2 B
 
12 12
D 4
2 
B
  230.94
 12 0.005 12

B  log 2 230.94  7.85  8 bits

47
Exercise
• Consider the ramp x(t) = 2t over (0, 1). For a
sampling interval of 0.1 s, and L = 4, obtain
i. the sampled signal
ii. quantized (by rounding) signal
iii. digital signal
iv. error signal, and compute the
v. quantization signal to noise ratio
vi. a statistical estimate of the SNR in dB

48
Answer
i. x[n]={0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0}
ii. xQ[n]={0,0,0.5,0.5,1.0,1.0,1.0,1.5,1.5,2.0,2.0}
iii. xc[n]={00,00,01,01,10,10,10,11,11,11}
iv. e[n]={0,0.2,-0.1,0.1,-0.2,0, 0.2, -0.1,0.1,-0.2,0}
v. SNRQ=18.9 dB
vi. SNRS=18.7 dB

49
Exercise
Telephone speech signals are sampled at 8 ksample/s and are transmitted
over a 64 kbits/s digital link. Consider the following signal, which is
transmitted over the telephone channel and then reconstructed using the
ideal DAC:

X(t) = 5 sin(10000πt − π/2).

The analog range of the ADC is adjusted to avoid saturation and to minimize
the quantization error. Determine:

(a) the quantizer step,


(b) the SQNR in dB,
(c) the folding frequency,
(d) the reconstructed signal y(t).
Answer

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