Digital Communication Systems: ECE-4001 TASK-3

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

DIGITAL COMMUNICATION

SYSTEMS

ECE-4001
TASK-3

To generate and reconstruct signal using DM and DPCM.

CHIRAG GAUR
18BEC0021
L39+40
Submitted to Prof.- VELMURUGAN T
TITLE: GENERATION AND RECONSTRUCTION OF SIGNAL USING DM.
TASK NO: 3A
DATE: 25-08-2020

AIM: To plot the wave form of input signal, sampled signal, quantized signal, reconstructed
signal for delta modulation (DM) using MATLAB.

THEORY:
Input signal is oversampled to increase correlation between the samples to permit the use of
simple quantization strategy.
 Sampled values are compared to the stair-case approximated (or predicted) values and the
error is calculated
 Calculated error is fed into the 1-bit quantizer which has only two levels ± Δ which is then
encoded and transmitted.
o To make sure that Δ is large enough to keep up with the signal (to avoid slope
overload) and small enough to model straight parts (to avoid granular noise) as
required, the following condition must be satisfied: d = (2*pi*fm*A/fs)

BLOCK DIAGRAM: -
a) Transmitter
b.) Receiver

ALGORITHM:
 Generate the input signal using sampling frequency fs
 Plot the sampled signal using STEM
 Quantize the signal using ‘ del’
 Modulate the DM signal using for and if condition
 Apply butter worth filter to collect the coefficients using ‘butter’
 Reconstruct the signal using ‘filter’

PROGRAM (MATLAB CODE):


clc
clear all
close all
fs=1000
f=10
A=5
t=0:1/fs:(2/f - (1/fs))
x=A*sin(2*pi*f*t)
figure(1)
subplot(2,1,1)
plot(t,x)
xlabel("time")
ylabel("Amplitude")
title("Sinusoidal signal")

x=A+x
subplot(2,1,2)
plot(t,x)
xlabel("time")
ylabel("Amplitude")
title("Shifted signal")

figure(2)
subplot(2,1,1)
stem(t,x)
xlabel("Time")
ylabel("Amplitude")
title("Sampled Signal")

delta=0.005
for n=1:199
if x(n+1)>x(n)
delta(n+1)=1+delta(n)
q(n)=1
else
delta(n+1)=delta(n)-1
q(n)=0
end
end

subplot(2,1,2)
stairs(delta)
xlabel("time")
ylabel("Ampplitude")
title("Quantized Signal")

figure(3)
subplot(2,1,1)
stem(q)
title("Encoded signal")

[b,a]=butter(2,0.002,"low")
y=filter(b,a,delta)
subplot(2,1,2)
plot(t,y)
xlabel("time")
ylabel("Amplitude")
title("Reconstructed Signal")

GRAPHICAL OUTPUT (CAPTURED PHOTO):


RESULT: The program for Delta modulation has been simulated in MATLAB and necessary
graphs are plotted.

VERIFICATION SIGNATURE:
TITLE: GENERATION AND RECONSTRUCTION OF SIGNA USING DPCM.
TASK NO: 3B
DATE: 01-09-2020

AIM: To plot the wave form of input signal, sampled signal, quantized signal, reconstructed
signal for Differential pulse code modulation (DPCM) using MATLAB.

THEORY:

 Differential pulse-code modulation (DPCM) is a signal encoder that uses the baseline
of pulse-code modulation (PCM) but adds some functionalities based on the
prediction of the samples of the signal. The input can be an analog signal or a digital
signal.
 If the input is a continuous-time analog signal, it needs to be sampled first so that a
discrete-time signal is the input to the DPCM encoder.
Option 1: take the values of two consecutive samples; if they are analog samples, quantize
them; calculate the difference between the first one and the next; the output is the difference.
Option 2: instead of taking a difference relative to a previous input sample, take the
difference relative to the output of a local model of the decoder process; in this option, the
difference can be quantized, which allows a good way to incorporate a controlled loss in the
encoding.
Applying one of these two processes, short-term redundancy (positive correlation of nearby
values) of the signal is eliminated; compression ratios on the order of 2 to 4 can be achieved
if differences are subsequently entropy coded because the entropy of the difference signal is
much smaller than that of the original discrete signal treated as independent samples.

BLOCK DIAGRAM:
a) Transmitter and Receiver
ALGORITHM:
 Generate the input signal using sampling frequency fs
 Plot the sampled signal using STEM
 Quantize the signal using ‘ quantiz’
 Convert the decimal to binary using ‘dec2bin’ Convert ‘bin2dec’
 Apply butter worth filter to collect the coefficients using ‘butter’
 Reconstruct the signal using ‘filter’

PROGRAM (MATLAB CODE):


clc;
clear all;
fm=4;
fs=20*fm;
am=2;
t=0:1/fs:1;
x=am*sin(2*pi*fm*t);
subplot(3,1,1);
plot(t,x,'');
title("Input Sinusoidal signal");

x1=x+2;
subplot(3,1,2)
plot(t,x1,'');
title("level shifted");
hold on;
t1=0:0.01:1;
x11=2+sin(2*pi*fm*t1);
subplot(3,1,3)
stem(t1,x11)
title('Sampled signal')

for n=1:length(x)
if n==1
e(n)=x(n);
eq(n)=round(e(n));
xq(n)=eq(n);
else
e(n)=x(n)-xq(n-1);
eq(n)=round(e(n));
xq(n)=eq(n)+xq(n-1);
end
end

figure
subplot(5,1,1)
stem(t,eq)
title('eq(n)')

subplot(5,1,2);
plot(t,xq,'');
title('quantized signal');

k=[0,0,0,0,1,1,1,1,1,0,0,0,0,0,0];
subplot(5,1,3)
stem(0:1:14,k);
title("binary representation")

for n=1:length(x)
if n==1
xqr(n)=eq(n);
else
xqr(n)=eq(n)+xqr(n-1);
end
end

subplot(5,1,4);
plot(t,xqr);
title("Reconstructed signal");
%low paas filter

[num den]=butter(2,4*fm/fs);
rec_op=filter(num,den,xqr);
subplot(515);
plot(t,rec_op,'k-');
xlabel('Time');
ylabel('Amplitude');
title('smooth reconstructed signal');

GRAPHICAL OUTPUT (CAPTURED PHOTO):


RESULT: The program for Differential pulse code modulation (DPCM) has been simulated in
MATLAB and necessary graphs are plotted.

VERIFICATION SIGNATURE:

You might also like