Assessment: Assigned

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

eIIove *rmstztr*te ‹of ecflr*‹o}cmgy

NAME - ARKAJYOTI SAHA

REG. NO. - 18BEC0938

SLOT - L37+L38

DCS LAB ASSESSMENT - 5

ASSIGNED BY - PROFF. THANIKAISELVAN

Vellore Institute of Technology


Quadrature Phase Shift Keying

clc
clear all
close all
% Quadrature Phase shift Keying
b=[0 1 1 0 1 0 0 0];
t=0:.01:length(b)-.01;
t1=0:.01:2-.01;
s1=2*cos(2*pi*1*t1+(pi/4));
s2=2*cos(2*pi*1*t1+(3*pi/4));
s3=2*cos(2*pi*1*t1+(5*pi/4));
s4=2*cos(2*pi*1*t1+(7*pi/4));
%QPSK
subplot(4,2,1);
plot(t1,s1);
title('pi/4');
xlabel('time')
ylabel('Amplitude');
subplot(4,2,2);
plot(t1,s2);
title('3pi/4');
xlabel('time')
ylabel('Amplitude');
subplot(4,2,3);
plot(t1,s3);
title('5pi/4');
xlabel('time')
ylabel('Amplitude');
subplot(4,2,4);
plot(t1,s4);
title('7pi/4');
xlabel('time')
ylabel('Amplitude');
s=[s3 s1 s1 s2];
subplot(4,1,3);
plot(t,s);
title('QPSK 1 ');
xlabel('time')
ylabel('Amplitude');
% verification
% verification
b=[0 1 1 0 1 0 0 0];
odd= [0 1 1 0];
t=0:0.01:length(b)-0.01;
bb=[]% bb is b(t)
j=2;
k=1;;
for i=1:length(t)
if t(i)<j
bb(i)=odd(k);
else
j=j+2;
k=k+1;
end
end
% carrier signal
c1=2*cos(2*pi*1*t);
c2=-2*cos(2*pi*1*t);
PSK1=[]%
for i= 1:length(bb)
if bb(i)==1
PSK1(i)=c1(i);
else
PSK1(i)=c2(i);
end
end
% subplot(3,1,1)
% plot(t,PSK1)
%%%%%%%%%%%%%%%%%%%%
even= [1 0 0 0];
t=0:0.01:length(b)-0.01;
bb=[]% bb is b(t)
j=2;
k=1;
for i=1:length(t)
if t(i)<j
bb(i)=even(k);
else
j=j+2;
k=k+1;
end
end
% carrier signal
c1=2*sin(2*pi*1*t);
c2=-2*sin(2*pi*1*t);
PSK2=[]%
for i= 1:length(bb)
if bb(i)==1
PSK2(i)=c1(i);
else
PSK2(i)=c2(i);
end
end
% subplot(3,1,2)
% plot(t,PSK2)
QPSK2=PSK1+PSK2;
subplot(4,1,4);
plot(t,QPSK2);
title('QPSK using two PSK method')
xlabel('time') ylabel('Amplitude');
ASK ir acs PSK TASK. fi dcs DPCM MidRise.m ‹Ice
clc
clear all
close all
4
5 % Quadrature Phase shift Keying
6 - b=[0 1 1 0 1 0 0 0];
7 t=0:.01:length(b)-.01;
8 - t1=0:.01:2-.01;
s s1=2*cos(2*pi*1*t1+(pi/4));
10 s2=2*cos(2*pi*1*t1+(3*pi/4))a
11 s3=2*cos(2*pi*1*t1+(5*pi/4));
12 — s4=2*cos(2*pi*1*t1+(7*pi/4));
lB %QPSK
14 — subplot(4,2,1);
15 — plot(t1,sl);
16 — title('pl/4');
17 xlabel('time')
lB ylabel('Amplitude');
19 subplot(4,2,2);
2o - plot(t1,s2);
21 - title('3pi/4');
22 - xlabel('mime')
22 - xlabel('mime')
23 ylabel('Amplitude');
24
25 subplot(4,2,3);
2s plot(t1,s3);
27 title('5pi/4');
28 xlabel('mime')
2s ylabel('Amplitude');
30
subplot(4,2,4);
32 plot(t1,s4);
title('7pi./4');
14 xlabel('time')
?5 ylabel('Ampl1tude');
36
37 — s= [ s 3 s1 s 1 s 2 ] ;
18 subplot(4,1,3);
39 — plot(t,s);
4o title('QPSK 1 ');
41 xlabel('time')
42 ylabel('Ampl tude');
44
45 % verification
46 â verific at1on

4g — b=[0 1 1 0 1 0 B 0];
49
odd= [0 1 1 0];

52 - t=0:0.01:length(b)-0.01;

54 — bb= [ ] % bb is b (I )
55 j=2;
5s k=1;;
r7 for i=1:lengtn(t)
5s if t(i)<j
r5 bb(i)=odd(k);
c0 else

?2
s› end
64
G5 end
G5 end
66 % carrier signal
G7 c1=2*cos(2*pi*1*t);
c8 — c2=-2*cos(2*pi*1*t);

70 - PSK1=[]%
71 - for i= 1:length(bb)
72 lf bb(i)==1
73 PSK1(i)=c1(i);
7< else
75 PSKl(i)=c2(i);
76 — end
77 end
78
79 % subplot(3,1,1)
gg % plot(t,PSK1)

82
83 even= [1 & 8 6] ;
84
85 - t=0:0.01:length(b)-0.01;
84
85 — t=B:0.01:length(b)-0.01;
86
87 — bb=[]% bb is b(t)
gs — j=2;
B9 k=1;
9o for i=1:length(t)
91 if t(i)<j
92 — bb ( i ) =even ( k ) j
gs — else
94 — 3' 3+2 i
95 — k= k+1;
96 — end

98 end
99 % carrier signal
i00 — c1=2*sin(2*pi*1*t);
101 — c2=-2*sin(2*pi*l't);
102
10J — PSK2=[]%
104 for i= 1:length(bb)
lB5 if bb ( i ) ==1
104 for i= 1:length(bb)
i0s if bb(i)==1
106 PsK2(i)=c1(i);
107 else
108 PSK2(i)=c2(i);
109 — end
110 end
111

113 % subplot(3,1,2)
114 % plot(t,PSK2)
115 QP5K2=PSK1+PSK2;
116
117 - subplot(4,1,4);
118 plot(t,QPSK2);
119 - title('0P/›K using ivo PSK metnod')
ig xlabel('time')
121 ylabel('Ampl1zude');

OUTPUT IN MATLAB
Probability of Error Calculation

clc;
clear all;
close all;
SNR=0:0.01:9; % in dB Eb/N0
SNR1=10.^(SNR/10); % removing the dB
bask_pe=0.5*erfc(sqrt(SNR1/4));
bfsk_pe=0.5*erfc(sqrt(SNR1/2));
bpsk_pe=0.5*erfc(sqrt(SNR1));
bqpsk_pe=erfc(sqrt(SNR1));
semilogy(SNR,bask_pe,SNR,bfsk_pe,SNR,bpsk_pe,SNR,bqp
sk_pe);
legend('bask pe','bfsk pe','bpsk pe','qpsk pe')
CODE SIMULATED IN MATLAB

.!.s QPSK.n dcs PROB ERROR CA

1 clc;
z clear all;
close all;
4 SNR=0:0.01:9; % in dB Eb/N0

6 - SNR1=10.’(SNR/10); % removing the dB


7
8 ba sk_pe=0. 5 * er+c ( s qrt (SNR1/4) ) ;
9 b Fsk_pe=0.5* er Fc ( s qrt (SNR1/ 2) ) ;
1e bpsk_pe=0 . 5 * er Fc ( sqrt (SNR1) ) ;
11 bqps k_pe=enf-c ( sqrt (SNR1) ) ;
12
13 semilogy(SNR,bask_pe,SNR,bfsk_pe,SNR,bpsk_pe,SNR,bqpsk_pe);
14
is — legend('bask pe','bfsk pe','bpsk pe','qpsk pe')

OUTPUT IN MATLAB
100
bask pe
bfsk pe
bpsk pe
10-1 qpsk pe

10-*

10—*

10-*
0 2 4 6 10

You might also like