0% found this document useful (0 votes)
171 views0 pages

Simulation of Pulse Code Modulation and Demodulation: All All

The document describes a simulation of pulse code modulation (PCM) and demodulation. It involves sampling an input signal, quantizing the sampled values, encoding the quantized samples into binary digits using pulse code modulation, transmitting the binary code, and decoding and reconstructing the original signal at the receiver. Key steps include sampling an input sine wave, quantizing the sampled values, encoding the quantized samples into binary PCM code, decoding the PCM code back into analog values, and reconstructing the original signal through filtering. Graphs are shown of the original, sampled, quantized, and reconstructed signals.

Uploaded by

Salma Nashit
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
171 views0 pages

Simulation of Pulse Code Modulation and Demodulation: All All

The document describes a simulation of pulse code modulation (PCM) and demodulation. It involves sampling an input signal, quantizing the sampled values, encoding the quantized samples into binary digits using pulse code modulation, transmitting the binary code, and decoding and reconstructing the original signal at the receiver. Key steps include sampling an input sine wave, quantizing the sampled values, encoding the quantized samples into binary PCM code, decoding the PCM code back into analog values, and reconstructing the original signal through filtering. Graphs are shown of the original, sampled, quantized, and reconstructed signals.

Uploaded by

Salma Nashit
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 0

SIMULATION OF PULSE CODE MODULATION AND DEMODULATION

AIM: To Simulate Pulse Code Modulation and Demodulation.


PROGRAM:

clc;
clear all;
close all;
%Signal amplitude and Frequency
a=1;
f=2;
t=0:0.01:1;
x=a*sin(2*pi*f*t)+a;
%plot message signal
subplot(2,1,1);
plot(t,x);
title('Input signal');
xlabel('time');
ylabel('amplitude');
%plot sampled signal
subplot(2,1,2);
stem(t,x);
title('Sampled Signal');
xlabel('time');
ylabel('amplitude');
%modulation process
partition=[0:0.1:2*a];
codebook=[0:0.1:((2*a)+0.1)];
[index,d]=quantiz(x,partition,codebook);
%plot quantized DM signal
figure;
subplot(2,1,1);
stairs(t,d);
title('Quantized Signal');
xlabel('time');
ylabel('amplitude');

%plot 1-bit encoder output


pcm=dec2bin(d);
display(pcm);
%Demodulation process
deco=bin2dec(pcm);
[b,a]=butter(3,0.1,'low');
recovered=filter(b,a,deco);
%plot the reconstucted signal
subplot(2,1,2);
plot(t,recovered);
title('Reconstructed Signal');
xlabel('time');
ylabel('amplitude');

MODEL GRAPH:
Input signal
2

amplitude

1.5

0.5

0.1

0.2

0.3

0.4

0.5
time

0.6

0.7

0.8

0.9

0.6

0.7

0.8

0.9

Sampled Signal
2

amplitude

1.5

0.5

0.1

0.2

0.3

0.4

0.5
time

Quantized Signal
2

amplitude

1.5

0.5

0.1

0.2

0.3

0.4

0.5
time

0.6

0.7

0.8

0.9

0.6

0.7

0.8

0.9

Reconstructed Signal
2

amplitude

1.5

0.5

-0.5

0.1

0.2

0.3

0.4

0.5
time

PCM output
01,01,01,01,01,01,01,01,01,10,10,10,10,10,10,10,10,01,01,01,01,01,01,01,01,01,00,00,00,
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,01,01,01,01,01,01,01,01,
01,10,10,10,10,10,10,10,10,01,01,01,01,01,01,01,01,01,00,00,00,00,00,00,00,00,00,00,00,
00, 00,00,00,00,00,00,00,00,00,00,00,00,01

RESULT: Simulation of Pulse Amplitude Modulation and Demodulation is done.

You might also like