You are on page 1of 2

clc, %% QPSK Demodulation

clear all, Rx_data = [];


close all, Rx_sig = Tx_sig;
data = [0 1 0 1 1 1 0 0 1 1]; for i = 1 : length(data)/2
subplot(511); z_in = Rx_sig((i-
stem(data, 'black', 'filled'); 1)*length(t)+1:i*length(t)).*cos(2*pi
grid on; *f*t);
title('Information before z_in_intg = (trapz(t,
transmitting'); z_in)*(2/T));
data_nrz = 2 * data - 1; if z_in_intg > 0
s_p_data = reshape(data_nrz, 2, Rx_in_data = 1;
length(data)/2); else
br = 10.^6; Rx_in_data = 0;
f = br; end
T = 1/br; z_qd = Rx_sig((i-
t = T/99 : T/99 : T; 1)*length(t)+1:i*length(t)).*sin(2*pi
%% QPSK Modulation *f*t);
y = []; z_qd_intg = (trapz(t,
y_in = []; z_qd)*(2/T));
y_qd = []; if z_qd_intg > 0
for i = 1:length(data)/2 Rx_qd_data = 1;
y1 = s_p_data(1,i) * else
cos(2*pi*f*t); Rx_qd_data = 0;
y2 = s_p_data(2,i) * end
sin(2*pi*f*t); Rx_data = [Rx_data, Rx_in_data,
y_in = [y_in, y1]; Rx_qd_data];
y_qd = [y_qd, y2]; end
y = [y, y1 + y2]; subplot(515);
end stem(Rx_data, 'black', 'filled');
Tx_sig = y; grid on;
tt = T/99:T/99:(T*length(data))/2; title('Quadrature Demodulation');
subplot(512);
plot(tt, y_in, 'black');
grid on;
title('Inphase components');
subplot(513);
plot(tt, y_qd, 'black');
grid on;
title('Outphase components');
subplot(514);
plot(tt, Tx_sig, 'black');
grid on;
title('Quadrature Modulation')

You might also like