Implement the cross correlation receiver for QPSK modulation
CODE:
clc; clear all all;; close all all;; % Assume the Eb and Tb values Eb = 2; Tb = 1; % Let us assume the received signal sequence as follows received = ['00' ['00',,'01' '01',,'10' '10',,'11' '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( 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( 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' plot(t,S1,'m'); ); xlabel('Time' xlabel('Time'); ); xlim([0 2]); 15BEC0898-K.RANJITH 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)
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)
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)
if t(i)
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