0% found this document useful (0 votes)
132 views

Experiment 4 PCM

The document describes an experiment on pulse code modulation (PCM) using MATLAB. PCM involves sampling an analog signal, quantizing the sample amplitudes, encoding the quantized values, transmitting the encoded values, decoding the received values, and reconstructing the analog signal. The MATLAB program implements these steps by sampling a sine wave, quantizing the samples, encoding using 3-bit codes, decoding, and reconstructing the signal using a Butterworth filter. The program demonstrates the key elements and process of PCM.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
132 views

Experiment 4 PCM

The document describes an experiment on pulse code modulation (PCM) using MATLAB. PCM involves sampling an analog signal, quantizing the sample amplitudes, encoding the quantized values, transmitting the encoded values, decoding the received values, and reconstructing the analog signal. The MATLAB program implements these steps by sampling a sine wave, quantizing the samples, encoding using 3-bit codes, decoding, and reconstructing the signal using a Butterworth filter. The program demonstrates the key elements and process of PCM.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

EXPERIMENT – 4

Aim: To study PCM (pulse code modulation) system

Software Requires: MATLAB 7.6.0(R2008)

Theory:
Pulse code modulation is known as a digital pulse modulation technique. The system consist
of three parts, i.e. transmitter, transmission path and receiver. A signal is pulse code
modulated to convert its analog information into a binary sequence, i.e., 1s and 0s. The output
of a PCM will resemble a binary sequence. The following figure shows an example of PCM
output with respect to instantaneous values of a given sine wave. Instead of a pulse train,
PCM produces a series of numbers or digits, and hence this process is called as digital. Each
one of these digits, though in binary code, represents the approximate amplitude of the signal
sample at that instant. In Pulse Code Modulation, the message signal is represented by a
sequence of coded pulses. This message signal is achieved by representing the signal in
discrete form in both time and amplitude.

Basic Elements of PCM

The transmitter section of a Pulse Code Modulator circuit consists of Sampling, Quantizing
and Encoding, which are performed in the analog-to-digital converter section. The low pass
filter prior to sampling prevents aliasing of the message signal. The basic operations in the
receiver section are regeneration of impaired signals, decoding, and reconstruction of the
quantized pulse train. Following is the block diagram of PCM which represents the basic
elements of both the transmitter and the receiver sections.

Low Pass Filter


This filter eliminates the high frequency components present in the input analog signal which
is greater than the highest frequency of the message signal, to avoid aliasing of the message
signal.

Sampler
This is the technique which helps to collect the sample data at instantaneous values of
message signal, so as to reconstruct the original signal. The sampling rate must be greater
than twice the highest frequency component W of the message signal, in accordance with the
sampling theorem.

Quantizer
Quantizing is a process of reducing the excessive bits and confining the data. The sampled
output when given to Quantizer, reduces the redundant bits and compresses the value.

Encoder
The digitization of analog signal is done by the encoder. It designates each quantized level by
a binary code. The sampling done here is the sample-and-hold process. These three sections
(LPF, Sampler, and Quantizer) will act as an analog to digital converter. Encoding minimizes
the bandwidth used.
Regenerative Repeater
This section increases the signal strength. The output of the channel also has one regenerative
repeater circuit, to compensate the signal loss and reconstruct the signal, and also to increase
its strength.

Decoder
The decoder circuit decodes the pulse coded waveform to reproduce the original signal. This
circuit acts as the demodulator.

Reconstruction Filter
After the digital-to-analog conversion is done by the regenerative circuit and the decoder, a
low-pass filter is employed, called as the reconstruction filter to get back the original signal.
Hence, the Pulse Code Modulator circuit digitizes the given analog signal, codes it and
samples it, and then transmits it in an analog form. This whole process is repeated in a
reverse pattern to obtain the original signal.

Program:
a = 4;

fm = 2;

fs = 100 * fm;

t = 0:1/fs:1; % for sampling

x = a*sin(2*pi*fm*t);

subplot(5,1,1);

plot(t, x, 'r');

xlabel('Time');

ylabel('Amplitude');

title('Original message signal');

subplot(5,1,2);

stem(t,x,'r');

xlabel('Time');

ylabel('Amplitude');

title('Sampled message signal');

enc = [];

for(i=1:length(x))

if(x(i)>0 && x(i)<=1)

e = [1 0 0];
xq(i) = 0.5;

elseif(x(i)>1 && x(i)<=2)

e = [1 0 1];

xq(i) = 1.5;

elseif(x(i)>2 && x(i)<=3)

e = [1 1 0];

xq(i) = 2.5;

elseif(x(i)>3 && x(i)<=4)

e = [1 1 1];

xq(i) = 3.5;

elseif(x(i)>-4 && x(i)<=-3)

e = [0 0 0];

xq(i) = -3.5;

elseif(x(i)>-3 && x(i)<=-2)

e = [0 0 1];

xq(i) = -2.5;

elseif(x(i)>-2 && x(i)<=-1)

e = [0 1 0];

xq(i) = -1.5;

elseif(x(i)>-1 && x(i)<=0)

e = [0 1 1];

xq(i) = -0.5;

end

enc = [enc e];

end

subplot(5, 1, 3)

plot(t, xq, 'b');

xlabel('Time');

ylabel('Amplitude');

title('Quantized Signal');

% Decoding
X_Q = [];

for i=1:3:length(enc)-2

if(enc(i) == 0 && enc(i+1)==0 && enc(i+2)==0)

x_q = -3.5;

elseif(enc(i) == 0 && enc(i+1)==0 && enc(i+2)==1)

x_q = -2.5;

elseif(enc(i) == 0 && enc(i+1)==1 && enc(i+2)==0)

x_q = -1.5;

elseif(enc(i) == 0 && enc(i+1)==1 && enc(i+2)==1)

x_q = -0.5;

elseif(enc(i) == 1 && enc(i+1)==0 && enc(i+2)==0)

x_q = 0.5;

elseif(enc(i) == 1 && enc(i+1)==0 && enc(i+2)==1)

x_q = 1.5;

elseif(enc(i) == 1 && enc(i+1)==1 && enc(i+2)==0)

x_q = 2.5;

elseif(enc(i) == 1 && enc(i+1)==1 && enc(i+2)==1)

x_q = 3.5;

end;

X_Q = [X_Q x_q];

end

subplot(5,1,4);

plot(t, X_Q);

xlabel('Time');

ylabel('Amplitude');

title('Decoded Wave');

[num, den] = butter(6, 4*fm/fs);

recon = filter(num,den,X_Q);

subplot(5,1,5)

plot(t,recon)

xlabel('Time');
ylabel('Amplitude');

title('reconstructed signal in the reciever');

You might also like