Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 21

BHAGWAN PARSHURAM INSTITUTE OF

TECHNOLOGY

DIGITAL COMMUNICATION FILE

Submitted to-

Mr. Dileep Kumar Dwivedi sir

Name-Tushar Rustagi

Class-Cse-A

Roll number-01420802719
INDEX

S.NO. EXPERIMENT DATE PAGE TEACHER’S REMARK


1 To perform signal sampling 1-3
using matlab software
2 To perform quantization of 4-5
signal using matlab software.
3 To perform PCM(pulse code 6-7
modulation) of signal using
matlab.
4 To perform ASK(binary 8-9
amplitude shift keying) of
message signal using matlab
software
5 To perform FSK(frequency 10-12
shift keying) modulation of
message signal using matlab
software
6 To perform PSK(pulse shift 13-14
keying) of message signal
using matlab software
7 To perform QPSK(quadrature 15-19
phase shift keying) of
message signal using matlab
software.
8
Experiment – 1
Aim-

To perform signal sampling using matlab software

Program code-

clc;

clear all;

close all;

tf=0.05;

t1=0:0.00005:tf;

f1=input(‘Enter sampling frequency’);

xt=cos(2*pi*f1*t1);

subplot(2,2,1);

plot(t1,xt);

xlabel(‘time’);

ylabel(‘amplitude’);

title(‘msg signal’);

f2=1.5*f1;

t2=0:1/f2:tf;

xt2=cos(2*pi*f1*t2);

subplot(2,2,2);

plot(t2,xt2);

hold on;

stem(t2,xt2,’r-‘);

xlabel(‘time’);

ylabel(‘amplitude’);
title(‘Under sampling’);

f3=2*f1;

t3=0:1/f3:tf;

xt3=cos(2*pi*f1*t3);

subplot(2,2,3);

plot(t3,xt3);

hold on;

stem(t3,xt3,’r-‘);

xlabel(‘time’);

ylabel(‘amplitude’);

title(‘Ideal sampling’);

f4=2.5*f1;

t4=0:1/f4:tf;

xt4=cos(2*pi*f1*t4);

subplot(2,2,4);

plot(t4,xt4);

hold on;

stem(t4,xt4,’r-‘);

xlabel(‘time’);

ylabel(‘amplitude’);

titile(‘Over sampling’);

Plot-
Experiment – 2
Aim-

To perform quantization of signal using matlab software.

Program code-

clc;

clear all;

close all;

a=4;

b=3;

f=0.1591;

t=0:0.02:2*pi;

x=a*sin(2*pi*f*t);

n=length(x);

q_out=zeros(1,n);

del=(2*a)/2^b;

l=-a+del/2;

h=a-del/2;

for i=l:del:h

for j=1:n

if(((i-del/2)<x(j)&&(x(j)<=i+del/2)))

q_out(j)=i;

end;

end;

end;

stem(t,q_out);
grid on;

hold on;

plot(t,x,’-r’);

xlabel(‘time’);

ylabel(‘amplitude’);

title(‘quatntized signal’);

Plot-
Experiment – 3
Aim-

To perform PCM(pulse code modulation) of signal using matlab.

Program code-

clc;

clear all;

close all;

f=2;

fs=20*f;

t=0:1/fs:1;

a=2;

x=a*sin(2*pi*f*t);

x1=x+a;

q_op=round(x1);

enco=de2bi(q_op,”left-msb”);

deco=bi2de(enco,”left-msb”);

x1=deco-a;

plot(t,x,’-r’,t,x1,’kt+’);

xlabel(‘time’);

ylabel(‘amplitude’);

legend(‘Original signal’,’Reconstructed signal’);

PLOT-
Experiment - 4
Aim-

To perform ASK(binary amplitude shift keying) of message signal using matlab software

Program code-

clc;

clear all;

close all;

f1=input(‘Enter carrier frequency’);

f2=input(‘Enter pulse frequency’);

A=4;

t=0:0.001:1;

x=A*sin(2*pi*f1*t);

y=(A/2)*square(2*pi*f2*t)+A/2;

z=x.*y;

subplot(3,1,1);

plot(t,x);

title(‘sine wave’);

xlabel(‘time’0;

ylabel(‘amplitude’);

subplot(3,1,2);

plot(t,y);

title(‘Digital signal’);

xlabel(‘time’);

ylabel(‘amplitude’);
subplot(3,1,3);

plot(t,z);

title(‘ASK’);

xlabel(‘time’);

ylabel(‘amplitude’);

PLOT-
Experiment – 5
Aim-

To perform FSK(frequency shift keying) modulation of message signal using matlab software

Program code-

clc;

clear all;

close all;

FC1=input(‘Enter carrier frequency for 1: ’);

FC2=input(‘Enter carrier frequency for 0: ’);

FP=input(‘Enter pulse duration: ’);

amp=input(‘Enter amplitude of Carrier: ’);

amp=amp/2;

T=0:0.001:1;

C1=amp*sin(2*pi*FC1*T);

C2=amp*sin(2*pi*FC2*T);

M=amp*square(2*pi*FP*T)+amp;

for(i=0:1000)

if(M(i+1)==0)

FSK(i+1)=C2(i+1);

else

FSK(i+1)=C2(i+1);

end

end

subplot(4,1,1);

plot(T,C1);
xlabel(‘Time’);

ylabel(‘Amplitude’);

title(‘Carrier signal for input 1’);

grid on;

subplot(4,1,2);

plot(T,C2);

xlabel(‘Time);

ylabel(‘Amplitude’);

title(‘carrier signal input 0’);

grid on;

subplot(4,1,3);

plot(T,M);

xlabel(‘Time’);

ylabel(‘Amplitude’);

title(‘Input signal’);

axis([0 1 -1 6]);

grid on;

subplot(4,1,4);

plot(T,FSK);

xlabel(‘Time’);

ylabel(‘Amplitude’);

title(‘FSK signal’);

gris on;

PLOT-
Experiment – 6
Aim-

To perform PSK(pulse shift keying) of message signal using matlab software

Program code-

clc;

clear all;

close all;

set(0,’defaultlinewidth’,2);

t=0:0.001:1;

f1=input(‘Enter carrier frequency: ’);

f2=input(‘Enter message signal: ’);

x=5*sin(2*pi*f1*t);

subplot(3,1,1);

plot(t,x);

xlabel(‘time’);

ylabel(‘amplitude’);

title(‘carrier signal’);

grid on;

u=square(2*pi*f2*t);

subplot(3,1,2);

plot(t,u);

xlabel(‘time’);

ylabel(‘amplitude’);

title(‘message signal’);

grid on;
v=x.*u;

subplot(3,1,3);

plot(t,v);

axis([0 1 -6 6]);

xlabel(‘time’);

ylabel(‘amplitude’);

title(‘PSK’);

grid on;

PLOT-
Experiment – 7
Aim-

To perform QPSK(quadrature phase shift keying) of message signal using matlab software.

Program code-

clc;

clear all;

close all;

x=randi([0 1],1,10);

for i=1:length(x)

if x(1)==0

p(i)=-1;

else

p(i)=1;

end

end

even_seq=p(1:2:length(x));

odd_seq=p(2:2:length(x));

i=1;

m=2:2:length(x);

t=0:0.01:length(x);

for j=1:length(t)

if t(j)<=m(i)

even_ps(j)=even_seq(i);

else

even_ps(j)=even_seq(i);
i=i+1;

end

end

i=1;

m=2:2:length(x);

for j=1:length(t)

if t(j)<=m(i)

odd_ps(j)=odd_seq(i);

else

odd_ps(j)=odd_seq(i);

i=i+1;

end

end

figure(1);

subplot(211);

plot(t,even_ps,'r');

xlabel(‘time’);

ylabel(‘amplitude’);

title(‘even ps’);

subplot(212);

plot(t,odd_ps,'k');

xlabel(‘time’);

ylabel(‘amplitude’);

title(‘odd ps’);

T=2;
C1=sqrt(2/T)*cos(2*pi*1*t);

C2=sqrt(2/T)*sin(2*pi*1*t);

figure(2);

subplot(211);

plot(t,C1,'r');

xlabel(‘time’);

ylabel(‘amplitude’);

title(‘C1’);

subplot(212);

plot(t,C2,'k');

xlabel(‘time’);

ylabel(‘amplitude’);

title(‘C2’);

r1=even_ps.*C1;

r2=odd_ps.*C2;

qpsk_sig=r1-r2;

figure(3);

subplot(311);

plot(t,r1,'r');

xlabel(‘time’);

ylabel(‘amplitude’);

title(‘qpsk_sig’);

subplot(312);

plot(t,r2,'k');

subplot(313);
plot(t,qpsk_sig,'m');

xlabel(‘time’);

ylabel(‘amplitude’);

title(‘qpsk_sig’);

Plot-

You might also like