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

Pulse Code Modulation and Differential Pulse Code Modulation

The document discusses and provides code examples for Pulse Code Modulation (PCM) and Differential Pulse Code Modulation (DPCM). For PCM, it shows how a message signal is quantized and encoded into a PCM signal. For DPCM, it demonstrates how a message signal is differentially encoded and decoded using a predictor and quantization. Code and plots are included to illustrate the PCM and DPCM encoding and decoding processes.

Uploaded by

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

Pulse Code Modulation and Differential Pulse Code Modulation

The document discusses and provides code examples for Pulse Code Modulation (PCM) and Differential Pulse Code Modulation (DPCM). For PCM, it shows how a message signal is quantized and encoded into a PCM signal. For DPCM, it demonstrates how a message signal is differentially encoded and decoded using a predictor and quantization. Code and plots are included to illustrate the PCM and DPCM encoding and decoding processes.

Uploaded by

Sanaullah Khan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

http://www.pbtstudies.blogspot.

com

PULSE CODE MODULATION AND DIFFERENTIAL PULSE CODE MODULATION:

Matlab Coding:

PCM:

t=0:0.0005:20;
partition=-1:0.1:1;
codebook= -1:0.1:1.1;
x=sin(t);
[index,quants]=quantiz(x,partition,codebook);
subplot(3,1,1);
plot(t,x);
title('Message Signal');
subplot(3,1,2);
plot(t,quants);
title('Quantized Signal');
y=uencode(quants,3);
subplot(3,1,3);
plot(t,y);
title('PCM Signal');

DPCM:
predictor=[0,1];
partition=-1:0.1:.91;
codebook=-1:0.1:1;
t=0:0.07:10;
x=sin(3*t);
subplot(3,1,1);
plot(t,x);
title('Message Signal');
encodedx=dpcmenco(x, codebook, partition, predictor);
subplot(3,1,2);
plot(t,encodedx);
title('DPCM signal');
decodedx=dpcmdeco(encodedx,codebook,predictor);
subplot(3,1,3);
axis auto;
plot(t,decodedx);
title('Decoded Signal');

1
http://www.pbtstudies.blogspot.com

Message Signal
1

0.5

-0.5

-1
0 2 4 6 8 10 12 14 16 18 20

Quantized Signal
1

0.5

-0.5

-1
0 2 4 6 8 10 12 14 16 18 20

PCM Signal
8

0
0 2 4 6 8 10 12 14 16 18 20

2
http://www.pbtstudies.blogspot.com

Message Signal
1

0.5

-0.5

-1
0 1 2 3 4 5 6 7 8 9 10

DPCM signal
13

12

11

10

7
0 1 2 3 4 5 6 7 8 9 10

Decoded Signal
1

0.5

-0.5

-1
0 1 2 3 4 5 6 7 8 9 10

3
http://www.pbtstudies.blogspot.com

You might also like