100% found this document useful (1 vote)
258 views13 pages

Implement The Cross Correlation Receiver For QPSK Modulation

The document implements a QPSK modulation and demodulation receiver. It generates QPSK modulated signals by mapping binary data bits to sine and cosine carrier signals. It then demodulates the received QPSK signal through correlation detection and recovers the transmitted binary data bits. Key steps include: 1) Mapping odd and even binary bits to cosine carrier signals to generate an I channel signal; 2) Mapping to sine carriers for a Q channel signal; 3) Summing the I and Q channels to produce the QPSK signal; 4) At the receiver, correlating the received signal with carrier signals to detect bits on each channel and recover the transmitted binary sequence.
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
100% found this document useful (1 vote)
258 views13 pages

Implement The Cross Correlation Receiver For QPSK Modulation

The document implements a QPSK modulation and demodulation receiver. It generates QPSK modulated signals by mapping binary data bits to sine and cosine carrier signals. It then demodulates the received QPSK signal through correlation detection and recovers the transmitted binary data bits. Key steps include: 1) Mapping odd and even binary bits to cosine carrier signals to generate an I channel signal; 2) Mapping to sine carriers for a Q channel signal; 3) Summing the I and Q channels to produce the QPSK signal; 4) At the receiver, correlating the received signal with carrier signals to detect bits on each channel and recover the transmitted binary sequence.
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/ 13

Implement the cross correlation receiver for QPSK modulation

CODE:

clc;
clear all;
close all;
% Assume the Eb and Tb values
Eb = 2;
Tb = 1;
% Let us assume the received signal sequence as follows
received = ['00','01','10','11'];
fc = 1 ;
t = 0:0.01:8-0.01;

E = 2*Eb;
T = 2*Tb;
t3 = 0:0.01:2-0.01;
% Receiver part - Transmitting the carrier signal
S1 = sqrt(2*E/T)*cos( 2*pi*fc*t + (pi/4) );
S2 = sqrt(2*E/T)*cos( 2*pi*fc*t + (3*pi/4) );
S3 = sqrt(2*E/T)*cos( 2*pi*fc*t+ (5*pi/4) );
S4 = sqrt(2*E/T)*cos( 2*pi*fc*t + (7*pi/4) );
figure(1)
subplot(2,2,1);
plot(t,S1,'m');
xlabel('Time');
xlim([0 2]);

15BEC0898-K.RANJITH KUMAR
ylabel('Amplitude');
title('S1(t)');
subplot(2,2,2);
plot(t,S2,'b');
xlim([0 2]);
xlabel('Time');
ylabel('Amplitude');
title('S2(t)');
subplot(2,2,3);
plot(t,S3,'g');
xlim([0 2]);
xlabel('Time');
ylabel('Amplitude');
title('S3(t)');
subplot(2,2,4);
plot(t,S4,'r');
xlim([0 2]);
xlabel('Time');
ylabel('Amplitude');
title('S4(t)');
s1 = cos(2*pi*t);
s2 = -cos(2*pi*t);
s3 = sin(2*pi*t);
s4 = -sin(2*pi*t);
j=2;
g = 1;
x = [];
b = [0 0 1 1];
b1= [0 1 0 1];

15BEC0898-K.RANJITH KUMAR
for i=1:length(t)
if(t(i)<j)
x(i)=b(g);
else
x(i)=b(g);
j=j+2;
g=g+1;
end
end
y =[];
for i=1:length(t)
if(x(i)==1)
y(i)=s1(i);
else
y(i)=s2(i);
end
end
j1 = 2;
g1 = 1;
x1 =[];
for i=1:length(t)
if(t(i)<j1)
x1(i)=b1(g1);
else
x1(i)=b1(g1);
j1=j1+2;
g1=g1+1;
end
end

15BEC0898-K.RANJITH KUMAR
y1 =[];
for i=1:length(t)
if(x1(i)==1)
y1(i)=s3(i);
else
y1(i)=s4(i);
end
end

qpsk = y+y1;
figure(2)
plot(t,qpsk,'LineWidth',1.5);
xlabel('Time');
ylabel('Amplitude');
title('QPSK Modulated signal');
figure(3)
subplot(1,2,1);
plot(t,y);
subplot(1,2,2);
plot(t,y1);

% Receiver part of the QPSK


n = 1;
binary = zeros(1,8);
received_1 = y;
received_2 = y1;
for i=1:400
if(t(i) >n)
n=n+1;

15BEC0898-K.RANJITH KUMAR
end
if (received_1(i) - y(i))==0
if (received_1(i) -s1(i))==0
binary(n) = 1;
else
binary(n)=0;
end
end
end

for i=400:800
if(t(i) >n)
n=n+1;
end
if (received_2(i) - y1(i))==0
if (received_2(i) -s3(i))==0
binary(n) = 1;
else
binary(n)=0;
end
end
end
z=1;
bin = zeros(1,length(t));

%Plotting the demodulated signal


for i=1:length(t)
if t(i)<z
bin(i) = binary(z);

15BEC0898-K.RANJITH KUMAR
else
bin(i)= binary(z);
z=z+1;
end
end
figure(5)
plot(t,bin,'m','LineWidth',1.5);
xlabel('Time');
ylabel('Amplitude');
title('Demodulated output');

OUTPUT:

15BEC0898-K.RANJITH KUMAR
15BEC0898-K.RANJITH KUMAR
QPSK Modulation and Demodulation

Code:
clc;
clear all;
close all;
t = 0:0.01:8-0.01;
b =[1 0 0 1];
s1 = cos(2*pi*t);
s2 = -cos(2*pi*t);
j = 2;
g = 1;

15BEC0898-K.RANJITH KUMAR
x =[];
for i=1:length(t)
if t(i)<j
x(i) = b(g) ;
else
j=j+2;
g=g+1;
end
end

y =[];
for i=1:length(t)
if x(i)==1
y(i) = s1(i);
else
y(i) = s2(i);
end
end

figure(1)
plot(t,y,'m','LineWidth',1.5);
title('Odd bits');
b1 = [ 0 0 1 1];
s3 = sin(2*pi*t);
s4 = -sin(2*pi*t);
j1 =2;
g1 = 1;
x1 =[];
for i=1:length(t)

15BEC0898-K.RANJITH KUMAR
if t(i)<j1
x1(i) = b1(g1);
else
j1=j1+2;
g1=g1+1;
end
end

y1 =[];
for i=1:length(t)
if x1(i)==1
y1(i) = s3(i);
else
y1(i) = s4(i);
end
end
figure(2)
plot(t,y1,'r');
title('Even bits');
qpsk = y+y1;
figure(3)
plot(t,qpsk,'m','LineWidth',1.5);
title('QPSK modulation');
t1 = 0:0.01:2-0.01;
c1 = cos(2*pi*t1-(pi/4));
c2 = cos(2*pi*t1-(3*pi/4));
c3 = cos(2*pi*t1-(5*pi/4));
c4 = cos(2*pi*t1-(7*pi/4));

15BEC0898-K.RANJITH KUMAR
figure(4)

subplot(3,2,1)
plot(t1,c1);
title('S1(t)');
subplot(3,2,2);
plot(t1,c2);
title('S2(t)');
subplot(3,2,3);
plot(t1,c3)
title('S3(t)');
subplot(3,2,4);
plot(t1,c4)
title('S4(t)');
subplot(3,2,[5 6]);
plot(t,qpsk);

OUTPUT:

15BEC0898-K.RANJITH KUMAR
15BEC0898-K.RANJITH KUMAR
15BEC0898-K.RANJITH KUMAR

You might also like