Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

EXPERIMENT 4

PULSE CODE MODULATION

1.0 OBJECTIVES
1.1 To generate sampled signal using SCILAB software.
1.2 To perform Pulse Code Modulation system using SCILAB.

2.0 EQUIPMENT/APPARATUS
SCILAB Software

3.0 THEORY

3.1 Pulse Code Modulation

Pulse Code Modulation (PCM) is the digitally encoded modulation technique that
is commonly used for digital transmission. With PCM, the pulses are of fixed
length and fixed amplitude. PCM is a binary system where a pulse or lack of
pulse within a prescribed time slot represents either a logic 1 or a logic 0
condition.

3.2 PCM Block Diagram

Figure 1 shows a simplified block diagram of a single-channel, simplex (one-way


only) PCM system. The low-pass filter band-limited the frequency of the analog
input signal to the maximum frequency in accordance with the sampling theorem.
It is then sampled and converted those samples to a multilevel PAM signal. The
sampled pulses (PAM samples) are rounded off to the nearest pre-determined
level (quantized level) in the quantizer. Then the quantized samples are converted
into groups according to the binary code in the encoder. These coded pulses are
then modulated digitally in the modulator (modem) before being transmitted
through the channel.

1
TRANSMITTER
Digital Signal

Analog Low Pass Digital


Sampler Quantizer Coder
Signal (i/p) Filter (LPF) Modulator

Channel

Analog Low Pass


Expandor Decoder Demodulator
Signal (i/p) Filter (LPF)

Digital Signal
RECEIVER

Figure 1 : Simplified block diagram of a single-channel, simplex PCM


transmission system.

3.2.1 Sampling
Sampling is the process of taking samples of the analog input signal at a
rate of Nyquist sampling frequency. The function of a sampling circuit in a
PCM transmitter is to periodically sample the continually changing analog
input voltage and convert those samples to a series of constant-amplitude
pulses that can more easily be converted to binary PCM code.

3.2.2 Quantization
Quantization is the process of converting an infinite number of amplitude
possibilities (analog signal samples) to a finite number of conditions (pre-
determined discrete levels). The number of quantization levels, L, depends
on the number of bits per sample, n, used to code the analog signal where
L = 2n (1)
The magnitude of the stepsize of the quantization levels is called resolution,
ΔV. The resolution depends on the maximum voltage, Vmax, and the
minimum voltage, Vmin, of the information signal, where
Vmax  Vmin
V 
L 1 (2)

2
3.2.3 Encoding
Encoding is a process where each quantized sample is digitally
encoded into n-bits codeword, where

n  log 2 L (4.5)

where n = number of bits/sample

L = number of quantization levels

3
EXAMPLE :

Consider a signal x(t) = sin 2π5t is to be quantized into 8 levels. The number of samples is
1000 . Write a command using Scilab to plot the following signal :
(i) Original signal
(ii) Quantized signal
Determine the encoding bit for each sample.
SOLUTION :

clc;
close;
t = 0:0.001:1;
x = sin(2*%pi*5*t);

L = 8;
//quantization
xmax = max(abs(x));
xq = x/xmax;
en_code = xq;
d = 2/L;
q = d*[0:L-1];
q = q-((L-1)/2)*d;
for i = 1:L
xq(find(((q(i)-d/2)<=
xq)&(xq<=(q(i)+d/2))))=q(i).*ones(1,length(find(((q(i)-
d/2)<=xq)&(xq<=(q(i)+d/2)))));
en_code(find(xq == q(i)))= (i-1).*ones(1,length(find(xq
== q(i))));
end
xq = xq*xmax;

plot2d2(t*2*%pi,x);
plot2d2(t*2*%pi,xq,5);

(iii) Encoding

n = log2(L);
c = zeros(length(x),n);
for i = 1:length(x)
for j = n:-1:0
if(fix(en_code(i)/(2^j))==1)
c(i,(n-j)) =1;
en_code(i) = en_code(i)-2^j;
end
end
end
disp(c)

4
EXERCISE

1) A sinusoidal input signal, m(t) having an amplitude of 1V is sampled at 1000 samples


and the samples are quantized to 16 evenly spaced levels.

(a) Use Scilab to plot the following signal :

(i) Original signal

(ii) Quantizing signal.

(b) Determine the PCM code using SCILAB.

2) A sinusoidal input signal, m(t) having an amplitude of 1V is sampled at 100 samples


and the samples are quantized to 8 evenly spaced levels. Use Scilab to plot the
following signal :

(a) Use Scilab to plot the following signal :

(iii) Original signal

(iv) Quantizing signal.

(b) Determine the PCM code using SCILAB.

(c) Determine the voltage of input signal that represented by 010, 011, and 110.

1. Report

*Your report should include: Result, Discussion, Conclusion, Appendix.

You might also like