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()tt= 3cos100π 1. Find the minimum sampling rate required to avoid aliasing.
2. If F s = 200 Hz , What is the discrete-time signal after sampling?
3. If F s = 75 Hz , 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 FFs = 2100Hz=
and the discrete-time signal is 100π 1 xn( )== x ( nT ) 3cos n == 3cosπ n 3cos2π n a 100 2 ECE 308-3 2
1 Sampling of Analog Signals
Solution:
b If Fs = 200 Hz , the discrete-time signal is
100π π 1 xn( )=== 3cos n 3cos n 3cos2π n 200 2 4
c If Fs = 75 Hz , the discrete-time signal is
100ππ 4 2π 1 x(nnn )===− 3cos 3cos 3cos 2ππ nn= 3cos2 3 75 3 3
c For the sampling rate Fs = 75 Hz , 1 FfFf75 and f = in part in (c). Hence ==s 3 75 F ==25Hz So, the analog sinusoidal signal is 3 yta ()= 3cos2π 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 xtaiii()= ∑ A cos(2π Ft+θ ) 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 > 2Fmax The analog signal should be in the range of
11Fi − ≤=fi ≤ 22Fs
or in radians
−π ≤=ωππii2 f ≤
The sampling rate FN = 2Fmax is called the Nyquist rate.
ECE 308-3 5
The Sampling Theorem
Example: Consider an analog signal
xa (tt )=+ 3cos50π 10sin300ππ tt + 3cos100
Solution
The frequencies in the analog signal
F1 = 25Hz F2 =150Hz F3 = 50Hz
The largest frequency is
FFmax= 2 =150Hz
The Nyquist rate is
FFN = 2max = 300 Hz
ECE 308-3 6
3 The Sampling Theorem
Example: The analog signal
xa (tttt )=+− 3cos2000π 5sin 6000ππ 10cos12000
1. What is the Nyquist rate for this signal?
2. Using a sampling rate F s = 5000 samples/s . What is the discrete-time signal obtained after sampling?
3. What is the analog signal yt a () we can reconstruct from the samples if we use ideal interpolation? Solution 1. The frequencies of the analog signal are
F1 =1 KHz F2 = 3KHz F3 = 6KHz
The Nyquist rate is FFN = 212KHzmax =
ECE 308-3 7
The Sampling Theorem
n 2. For Fs = 5KHz xn()== xaa ( nT ) x Fa 13 6 =+−3cos2ππnn 5sin2 10cos2 π n 55 5 12 1 =+−−+3cos2ππnn 5sin2 1 10cos2 π 1 n 55 5 12 1 =−−3cos2ππnn 5sin2 10cos2 π n 55 5 12 =−7cos2ππnn − 5sin2 55 F For F = 5KHz , the folding frequency is F ==s 2.5KHz s max 2
Hence, F 1 = 1KHz is not effected by aliasing
' F2 = 3 KHz is changed by the aliasing effect FFF22=−=−s 2 KHz
' F3 = 6KHz is changed by the aliasing effect FFF33=−=s 1KHz 1 2 1 f = f = f = So that normalize frequencies are 1 5 2 5 3 5 ECE 308-3 8
4 The Sampling Theorem
Solution (cont)
c. The analog signal that we can recover is
yta ( )= −− 7cos2000π t 5cos4000π 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 x ()nQxn= [ ()] >> x=0.9.^t; q >> plot (t,x) >> hold on >> n=0:10; enqq()= xn ()− xn () The quantizer error is >> x=0.9.^n; >> stem(t,x,'r') Example: Let’s consider the discrete-time signal as
0.9n n ≥ 0 xn()= 00n <
The sampling frequency is Fs =1.Hz ECE 308-3 10
5 Quantization of Continuous-Amplitude Signals
n xq ()n x()n enq () 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) 8 0.4000 0.4305 -0.0305 >> hold on >> 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
∆ ∆ − ≤≤en() 22q
• If x min and xmax represent the minimum and maximum value of x () n and L is number of quantization level, then
x − x ∆= max min L −1
ECE 308-3 12
6 Quantization of Continuous-Amplitude Signals
In the example xmin = 0 , x max = 1 , and, L = 11 , which leads to ∆ = 0.1 .
Note:
If L increases, ∆ decreases. Hence, the quantization error
enq () 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 x a () t .
ECE 308-3 14
7 Quantization of Sinusoidal Signal
The analog signal x a () t is almost linear between quantization levels. The quantization error
etqaq()= xt ()− xt ()
eq(t) ∆/2 -τ t -∆/2 0 τ
∆ Here etq ()= t −τ ≤≤t τ 2τ
The mean-square error power Pq is
Find discrete time signal x1(n) and x2(n)
2232 ττ τ 1122 11∆ 2 ∆∆t τ Pqq== e() tdt e q () tdt Ptdtq === 2τ ∫∫−τ τ 0 ττ∫0 22312 ττ 0
ECE 308-3 15
Quantization of Sinusoidal Signal
For b bit the all range is 2A, then
2A ∆= 2b x ()t Hence, the mean-square error power P q for the signal a is 4A22A P == q (12)222bb (3)2
The average power of the signal xa ()t is
2 1 Tp 2 A PAtdtx =Ω=()cos ∫0 Tp 2
The ratio of the signal average power to the noise power is the signal-quantization noise ratio (SQNR) gives
P 3 SQNR ==x 22b In dB, SQNR( dB )= 10log10 SQNR=+ 1.76 6.02 b 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 FFs ≥=220.max Khz a FKhzmax =10 .
Fs b FKhzs = 8. FKhz==4. fold 2 So, F = 5 Khz will be alias of 3KHz
c FKhz= 9 will be alias of 1KHz.
ECE 308-3 19
Problem
Problem 1.15 xa ()tFt= sin2π 0 −∞ >> n=0:99; >> x=sin(2*pi*0.1*n); >> stem (n,x) ECE 308-3 20 10