You are on page 1of 10

EEE

3309/311
Lecture 3: Sampling, Reconstruction
and Quantization
Contents

• Section 1.4.1 & Examples 1.4.2


• Section 1.4.2: The sampling theorem and reconstruction of analog signals x(t) from
sampled signals x(n)
• Example 1.4.3 and 1.4.4
• Figure 1.4.6
• Section 1.4.3: Quantization of continuous amplitude signals
• Quantization error noise eq(n)
• Step size 
• Figure 1.4.8
• Equation for SQNR (equation 1.4.32)
• Exercise Problems: 1.7, 1.8, 1.9, 1.10, 1.13 and 1.14
Matlab code for Sampling: 1st Part
• %% Example on Sampling:
• F= 10; % CT signal frequency, Hz
• Fs= 40; % Sampling frequency, Hz
• f= F/Fs; % Normalized frequency
• Ts= 1/Fs; % Sampling interval, sec
• Parameters:
• T= 10*Ts; % Max value of time range
• CT signal frequency F= 10 Hz • ta= 0:0.0001:T; % Total time duration, sec
• Sampling frequency Fs= 40 Hz • t= 0:Ts:T; % time array for sampled sigal
• Self-study: Run the code and examine the •
followings: • xa= cos(2*pi*F*ta); % CT signal
• Find time period of the signal from one • xn= cos(2*pi*F*t); % Sampled Signal x(n)
period and find F. Verify with the given F= •
10 Hz • figure(1)
• Find Ts from graph and Fs= 1/Ts and • plot(ta,xa)

verify with Fs= 40 Hz. • hold on


• stem(t,xn,'r')
• xlabel('sec')
• ylabel('Signal Level')
• grid on
• legend('CT Signal','Sampled Signal')
• axis([0 T -1.5 1.5])
• F1= 10; % CT signal frequency, Hz
• F2= 50; % CT signal frequency, Hz
Matlab code for Sampling: 2nd Part •
• Fs= 40;% Sampling frequency, Hz
• %Fs= 4*F2; % Fs is 4 times the maximum frequency F2
• Ts= 1/Fs; % Sampling interval, sec
• T=20*Ts;

• Two signals with F1= 10 and F2= 50 Hz • t= 0:Ts:T; % time array



• First use Fs 2F2= 200 Hz (let)
• x1= cos(2*pi*F1*t); % Sampled signal x1(n)
• Self-study: Run the code and examine the • x2= cos(2*pi*F2*t); % Sampled signal x2(n)
followings: •
• Find time period of the signal from one period • figure
and find F1 and F2. Verify with the given F1= 10 • plot(t,x1,'ro-')
Hz and F2= 50 Hz • hold on
• Find Ts from graph and Fs= 1/Ts and verify with • plot(t,x2,'bo--')
Fs= 200 Hz. • xlabel('sec')
• Then use Fs= 40 Hz as in example 1.4.1 • ylabel('Signal')
• See if x1(n) and x2(n) become the same signal • legend('x1','x2')
• Verify with example 1.4.1 • grid on
• Can you identify aliasing here? • axis([0 T -1.5 1.5])
ADC Block Diagram
Example: A sinusoidal signal
1.5
CT Signal
1 Sampled Signal

0.8
0.5

Signal Level
0.6 0

-0.5
0.4

-1

0.2
-1.5
0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1
sec

-0.2

-0.4

-0.6

-0.8

-1
0 0.05 0.1 0.15 0.2 0.25

A CT Cosine wave (F=10 Hz) Sampled Cosine wave (F=10 Hz & Fs= 80 Hz)
Sampled sinusoidal signal

1.5

0.5

Signal Level
0

-0.5

-1

-1.5
0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1
sec

Resulting DT Signal
Quantization and Encoding on DT signal
1.5

0.5

• Quantization L=8 111

Signal Level
0

• Let number of bits, b= 3 L=7 -0.5 110


• L= 2^3= 8 L=6 -1
101
• Here Xmax= +1 and Xmin= -1; L=5 -1.5
0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1
100
sec

• Dynamic range (DR)= Xmax- L=4 011


Xmin= 2;
L=3 010
• Step size, = DR/(L-1)=2/7=0.286
L=2 001
• Amplitude levels:
L=1
• {-1.0000 -0.7143 -0.4286 -0.1429 000
0.1429 0.4286 0.7143 1.0000}

• After Encoding:
• X[n]={111 110 100 001 000 001 100
110 111}
DAC

• Start with the binary values of the signal


• Convert these binary values to actual signal amplitude by using look-up table
• Pass these sampled values through a ZOH and LP filter to get x(t)

ZOH LPF
Binary values LUT x(t)
Sinc Function
1

0.8

0.6

0.4

Amplitude
0.2

-0.2

-0.4
-3 -2 -1 0 1 2 3
Time (sec)

You might also like