Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
179 views

Lab 1 Pulse Code Modulation

This document summarizes the key steps in a digital communication system using pulse code modulation (PCM): 1) An analog signal is sampled and quantized into discrete levels, assigning it a digital code. 2) The digital codes are encoded into binary format for transmission. 3) At the receiver, the binary data is decoded back into the digital codes, and then reconstructed into the original quantized signal.

Uploaded by

Abbaas Alif
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
179 views

Lab 1 Pulse Code Modulation

This document summarizes the key steps in a digital communication system using pulse code modulation (PCM): 1) An analog signal is sampled and quantized into discrete levels, assigning it a digital code. 2) The digital codes are encoded into binary format for transmission. 3) At the receiver, the binary data is decoded back into the digital codes, and then reconstructed into the original quantized signal.

Uploaded by

Abbaas Alif
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

DIGITAL COMMUNICATION SYSTEM

ECE-4001 – LAB EXPERIMENT-1

TITLE: PULSE CODE MODULATION

DONE BY:
G.TAMIL SELVAN
16BEC1135
CODE:
clc;
close all;
clear all;
n=input('Enter n value for n-bit PCM system : ');
n1=input('Enter number of samples in a period : ');
L=2^n;

% % Signal Generation
% x=0:1/100:4*pi;
% y=8*sin(x); % Amplitude Of
signal is 8v
% subplot(2,2,1);
% plot(x,y);grid on;
% Sampling Operation
x=0:2*pi/n1:4*pi; % n1 nuber of samples
have tobe selected
s=8*sin(x);
subplot(3,1,1);
plot(s);
title('Analog Signal');
ylabel('Amplitude--->');
xlabel('Time--->');
subplot(3,1,2);
stem(s);grid on; title('Sampled Sinal');
ylabel('Amplitude--->'); xlabel('Time--->');

% Quantization Process
vmax=8;
vmin=-vmax;
del=(vmax-vmin)/L;
part=vmin:del:vmax; %
level are between vmin and vmax with difference of del
code=vmin-(del/2):del:vmax+(del/2); % Contaion
Quantized valuses
[ind,q]=quantiz(s,part,code); %
Quantization process

% ind contain index number and q contain quantized


values
l1=length(ind);
l2=length(q);

for i=1:l1
if(ind(i)~=0)
% To make index as binary decimal so started from 0 to N
ind(i)=ind(i)-1;
end
i=i+1;
end
for i=1:l2
if(q(i)==vmin-(del/2)) % To
make quantize value inbetween the levels
q(i)=vmin+(del/2);
end
end
subplot(3,1,3);
stem(q);grid on; %
Display the Quantize values
title('Quantized Signal');
ylabel('Amplitude--->');
xlabel('Time--->');

% Encoding Process
figure
code=de2bi(ind,'left-msb'); % Cnvert the
decimal to binary
k=1;
for i=1:l1
for j=1:n
coded(k)=code(i,j); % convert
code matrix to a coded row vector
j=j+1;
k=k+1;
end
i=i+1;
end
subplot(2,1,1); grid on;
stairs(coded); % Display
the encoded signal
axis([0 100 -2 3]); title('Encoded Signal');
ylabel('Amplitude--->');
xlabel('Time--->');

% Demodulation Of PCM signal

qunt=reshape(coded,n,length(coded)/n);
index=bi2de(qunt','left-msb'); %
Getback the index in decimal form
q=del*index+vmin+(del/2); %
getback Quantized values
subplot(2,1,2); grid on;
plot(q);
% Plot Demodulated signal
title('Demodulated Signal');
ylabel('Amplitude--->');
xlabel('Time--->');

COMMAND WINDOW:
Enter n value for n-bit PCM system : 3

Enter number of samples in a period : 20

OUTPUT:

You might also like