You are on page 1of 10

ECE 308 -3

ECE 308
Sampling of Analog Signals
Quantization of Continuous-Amplitude
Signals

Z. Aliyazicioglu

Electrical and Computer Engineering Department


Cal Poly Pomona

ECE 308-3 1

Sampling of Analog Signals


Example: xa (t ) = 3cos100π t
1. Find the minimum sampling rate required to avoid aliasing.
2. If Fs = 200 Hz, What is the discrete-time signal after sampling?
3. If Fs = 75Hz , What is the discrete-time signal after sampling?
4. What is the frequency F of a sinusoidal that yields sampling
identical to obtained in part c?

Solution:

a Ω = 100π F = 50 Hz
The minimum sampling rate is Fs = 2 F = 100Hz

and the discrete-time signal is


100π 1
x(n) = xa (nT ) = 3cos n = 3cosπ n = 3cos2π n
100 2
ECE 308-3 2

1
Sampling of Analog Signals
Solution:
b If Fs = 200 Hz , the discrete-time signal is

100π π 1
x(n) = 3cos n = 3cos n = 3cos 2π n
200 2 4

c If Fs = 75 Hz , the discrete-time signal is

x( n ) = 3cos
100π
n = 3cos

n = 3cos 2π −
 2π  n = 3cos 2π 1 n
  3
75 3  3 
c For the sampling rate Fs = 75 Hz ,
1
F = fFs = f 75 and f = in part in (c). Hence
3
75 So, the analog sinusoidal signal is
F= = 25Hz
3
ya (t ) = 3cos 2π Ft
= 3cos50π t
ECE 308-3 3

The Sampling Theorem

We must have some information about the analog signal


especially the frequency content of the signal, to select the
sampling period T or sampling rate Fs.

For example A speech signal goes below around 20Khz.


A TV signal is up to 5Mhz.
Any analog signal can be represented as sum of sinusoids of
different amplitudes, frequencies, and phases.
N
xa (t ) = ∑ Ai cos(2π Fi t + θ i )
i =1

where N the number of frequency components. Suppose that Nth


frequency do not exceed the largest frequency Fmax

Fi < Fmax

ECE 308-3 4

2
The Sampling Theorem

To avoid the aliasing problem, is selected so that

Fs > 2 Fmax

The analog signal should be in the range of

1 F 1
− ≤ fi = i ≤
2 Fs 2

or in radians

−π ≤ ωi = 2π fi ≤ π

The sampling rate FN = 2 Fmax is called the Nyquist rate.

ECE 308-3 5

The Sampling Theorem


Example: Consider an analog signal
xa (t ) = 3cos50π t + 10sin 300π t + 3cos100π t

Solution

The frequencies in the analog signal


F1 = 25Hz F2 = 150Hz F3 = 50Hz

The largest frequency is


Fmax = F2 = 150Hz

The Nyquist rate is


FN = 2 Fmax = 300 Hz

ECE 308-3 6

3
The Sampling Theorem
Example: The analog signal
xa (t ) = 3cos 2000π t + 5sin 6000π t − 10cos12000π t

1. What is the Nyquist rate for this signal?


2. Using a sampling rate Fs = 5000 samples/s . What is the
discrete-time signal obtained after sampling?
3. What is the analog signal ya (t ) we can reconstruct from
the samples if we use ideal interpolation?
Solution
1. The frequencies of the analog signal are
F1 = 1 KHz F2 = 3 KHz F3 = 6KHz

The Nyquist rate is FN = 2 Fmax = 12 KHz

ECE 308-3 7

The Sampling Theorem


2. For Fs = 5KHz  n 
x( n ) = xa (nT ) = xa  
 Fa 
1  3 6
= 3cos 2π   n + 5sin 2π   n − 10cos 2π   n
 5  5  5
1  2  1
= 3cos 2π   n + 5sin 2π  1 −  n − 10cos 2π  1 +  n
 5  5  5
1 2 1
= 3cos 2π   n − 5sin 2π   n − 10cos 2π   n
 5 5 5
1 2
= −7 cos 2π   n − 5sin 2π   n
5  5
F
For Fs = 5KHz , the folding frequency is Fmax = s = 2.5KHz
2
Hence, F1 = 1 KHz is not effected by aliasing
F2 = 3 KHz is changed by the aliasing effect F2' = F2 − Fs = −2 KHz

F3 = 6KHz is changed by the aliasing effect F3' = F3 − Fs = 1 KHz

1 2 1
So that normalize frequencies are f1 = f2 = f3 =
5 5 5
ECE 308-3 8

4
The Sampling Theorem

Solution (cont)

c. The analog signal that we can recover is


ya (t ) = −7cos 2000π t − 5cos 4000π t

which is different than the original signal xa (t )

ECE 308-3 9

Quantization of Continuous-Amplitude Signals

• Converting a discrete-time continuous-amplitude signal into a digital


signal by expressing each sample value as a finite number of digits,
is called quantization.
• The error between continuous-valued signal and a finite set of
discrete value levels signal is called quantization error or
quantization noise.
>> t=0:0.01:10;
The output of quantizer is xq (n) = Q [ x(n) ] >> x=0.9.^t;
>> plot (t,x)
>> hold on
The quantizer error is eq (n) = xq (n) − x( n) >> n=0:10;
>> x=0.9.^n;
>> stem(t,x,'r')
Example:

Let’s consider the discrete-time signal


as
0.9n n≥0
x ( n) = 
0 n<0

The sampling frequency is Fs = 1Hz.


ECE 308-3 10

5
Quantization of Continuous-Amplitude Signals

n xq (n) x ( n) eq (n)

0 1.0000 1.0000 0.0000


1 0.9000 0.9000 0.0000
2 0.8000 0.8100 -0.0100
3 0.7000 0.7290 -0.0290
4 0.7000 0.6561 0.0439
5 0.6000 0.5905 0.0095
>> t=0:0.01:10; 6 0.5000 0.5314 -0.0314
>> x=0.9.^t; 7 0.5000 0.4783 0.0217
>> plot (t,x)
>> hold on
8 0.4000 0.4305 -0.0305
>> t=0:10; 9 0.4000 0.3874 0.0126
>> x=0.9.^t; 10 0.3000 0.3487 -0.0487
>> y=0.1*round(10*x);
>> stem(t,y,'r')
>> grid on
ECE 308-3 11

Quantization of Continuous-Amplitude Signals

Using rounding process for quantization. The other method is truncation ,


which discards the excess digits.

• The values allowed in the digital signal are called quantization


level.
• Distance ∆ between two quantization level is called quantization
step size or resolution
• If we use rounding process the quantization error is the range of

∆ ∆
− ≤ eq (n) ≤
2 2

• If xmin and xmax represent the minimum and maximum value of x( n)


and L is number of quantization level, then

xmax − xmin
∆=
L −1
ECE 308-3 12

6
Quantization of Continuous-Amplitude Signals
In the example xmin = 0 , xmax = 1 , and, L = 11 , which leads to ∆ = 0.1 .

Note:

If L increases, ∆ decreases. Hence, the quantization error


eq (n) decreases and the accuracy of the quantizer increases.

ECE 308-3 13

Quantization of Sinusoidal Signal

Let’s look at the quantizer error by quantizing the analog sinusoidal


signal xa (t ).

ECE 308-3 14

7
Quantization of Sinusoidal Signal
The analog signal xa (t ) is almost linear between quantization levels.
The quantization error

eq (t ) = xa (t ) − xq (t )

eq(t)
∆/2
-τ t
-∆/2 0 τ


Here eq (t ) = t −τ ≤ t ≤ τ

The mean-square error power Pq is

Find discrete time signal x1(n) and x2(n)

1  ∆  t 3 τ ∆2
2 2
1 τ 1 τ 1 τ ∆ 2
Pq = ∫ τ e (t )dt = τ ∫ τ∫
2
eq2 (t )dt Pq =   t dt =   =

q
− 0 0
 2τ  τ  2τ  3 0 12

ECE 308-3 15

Quantization of Sinusoidal Signal

For b bit the all range is 2A, then

2A
∆=
2b
Hence, the mean-square error power Pq for the signal xa (t ) is
4 A2 A2
Pq = 2b
=
(12)2 (3)22b

The average power of the signal xa (t ) is


2
1 Tp A
∫ ( A cos Ωt ) dt = 2
2
Px =
Tp 0

The ratio of the signal average power to the noise power is the
signal-quantization noise ratio (SQNR) gives
Px 3 2b
SQNR = = 2 In dB, SQNR(dB) = 10log10 SQNR = 1.76 + 6.02b
Pq 2

ECE 308-3 16

8
Digital-to-Analog Conversion
Some cases we may need to convert digital signal to analog
signal again.
The process of converting a digital signal into an analog signal is
called Digital-to-Analog (DAC).
All D/A converters use some kind of interpolation. A simple form
of D/A conversion is zero-order hold or staircase
approximation. Simply holds constant the value of one sample
until the next one is received.

ECE 308-3 17

Digital-to-Analog Conversion
A Linear interpolation is connect successive samples with strait-
line. It needs T second delay so that has knowledge about next
sample values.

Better interpolation can be achieved by using more sophisticated


high-order interpolation techniques.
ECE 308-3 18

9
Problem
Problem 1.7
• An analog signal contains frequencies up to 10Khz.
a. What range of sampling frequencies allows exact
reconstruction of this signal from the samples?
b. Suppose that we sample this signal with a sampling
frequency Fs=8 KHz. Examine what happens to the
frequency F1=5Khz.
c. Repeat part (b) for a frequency F2=9Khz.

Solution 1.7 a Fmax = 10 Khz. Fs ≥ 2 Fmax = 20 Khz.

Fs = 8Khz. Fs
b Ffold = = 4 Khz.
2
So, F = 5 Khz will be alias of 3KHz

c F = 9 Khzwill be alias of 1KHz.

ECE 308-3 19

Problem
Problem 1.15 xa (t ) = sin 2π F0t −∞ < t < ∞
F0
and x ( n ) = x ( nT ) = sin 2π n
Fs
Fs = 5 Khz. and F0 = 0.5 Khz. 0 ≤ n ≤ 99
Solution 1.15

>> n=0:99;
>> x=sin(2*pi*0.1*n);
>> stem (n,x)

ECE 308-3 20

10

You might also like