0% found this document useful (0 votes)
116 views7 pages

Task No. 2: Generation of Signal Using PCM

This document describes a MATLAB experiment on pulse code modulation (PCM). The aim is to plot the waveform of an input signal, sampled signal, quantized signal, and reconstructed signal using PCM. The theory section explains how PCM works by sampling an analog signal at uniform intervals, quantizing the samples, and encoding the quantized values. The algorithm section lists the steps to generate and process the signals. The program section implements these steps in MATLAB by generating a sine wave input, sampling it, quantizing the samples, encoding to binary, decoding, filtering to reconstruct the signal, and plotting the various signal waveforms.

Uploaded by

Aniket Saxena
Copyright
© © All Rights Reserved
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)
116 views7 pages

Task No. 2: Generation of Signal Using PCM

This document describes a MATLAB experiment on pulse code modulation (PCM). The aim is to plot the waveform of an input signal, sampled signal, quantized signal, and reconstructed signal using PCM. The theory section explains how PCM works by sampling an analog signal at uniform intervals, quantizing the samples, and encoding the quantized values. The algorithm section lists the steps to generate and process the signals. The program section implements these steps in MATLAB by generating a sine wave input, sampling it, quantizing the samples, encoding to binary, decoding, filtering to reconstruct the signal, and plotting the various signal waveforms.

Uploaded by

Aniket Saxena
Copyright
© © All Rights Reserved
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/ 7

Task No.

2
Generation of signal using PCM

Divyanshu Sharma
18BEC0003
L39+40
Date : 25-07-2020

Aim:
To plot the wave form of input signal, sampled signal, quantized signal,
reconstructed signal for Pulse code modulation (PCM) using MATLAB.

Theory:
PCM is a discrete-time, discrete-amplitude waveform-coding process, by
means of which an analog signal is directly represented by a sequence
of coded pulses.

The amplitude of the analog signal is sampled at uniform intervals


and each sample is quantized to its nearest value within a
predetermined range of digital levels.

The incoming message signal is sampled with a train of rectangular


pulses short enough to closely approximate the instantaneous
sampling process.

To restore the signal samples to their correct relative level, we must, of


course, use a device in the receiver with a characteristic complementary
to the compressor. Such a device is called an expander
Sampling: Select data points from the analogue (continuous time –
continuous amplitude) signal to create discrete data.

Quantization: Transform sampled amplitude of message signal taken


at discrete times into a discrete amplitude taken from a finite set of
possible amplitudes, creating digital data.

Encoding: Assign binary levels to each of the possible amplitude values


Alorithm:
1. Generate the input signal using sampling frequency fs
2. Plot the sampled signal using STEM
3. Quantize the signal using ‘ quantiz’
4. Convert the decimal to binary using ‘dec2bin’
5. Convert ‘bin2dec’
6. Apply butter worth filter to collect the coefficients using ‘butter’
7. Reconstruct the signal using ‘filter’

Programme:
clc
clear all
close all

f=10;
fs=1000;
a=3
t=0:1/fs:((2/f)-(1/fs));

%Level shifting
x=a+a*sin(2*pi*f*t);
figure(1)
subplot(2,1,1);
plot(t,x);
title('Input Signal');

%Sampled Signal
subplot(2,1,2);
stem(t,x);
title('Sampled Signal');

partition = [-1:1:5]; codebook = [-


1:1:6];
[~,q]=quantiz(x,partition,codebook);

%Quantized Signal
figure(2)
subplot(2,1,1);
stairs(t,q);
title('Quantized Signal');

%Encoded Signal
y=dec2bin(q);
%Dequantized Signal
z=bin2dec(y);
[b,a]=butter(2,2*f/fs,'low');

k=filter(b,a,z);
subplot(2,1,2)
plot(t,z)
title('Dequantized Signal');

%Reconstructed Signal
figure(3)
plot(t,k)
title('Reconstructed Signal');

Graphical Output (Captured Photo)


Result:
The program for Pulse code modulation has been simulated in MATLAB
and necessary graphs are plotted.

Verification Signature

You might also like