0% found this document useful (0 votes)
14 views6 pages

439-Lab 3 MWC

The document outlines a laboratory report on simulating a QPSK modulation scheme and analyzing its Bit Error Rate (BER) in an AWGN channel. It includes tasks for generating QPSK streams, performing modulation and demodulation, conducting BER analysis, implementing methods to reduce BER using Gray coding, and comparing QPSK with BPSK. The results demonstrate that Gray coding reduces BER compared to uncoded QPSK, and the performance of QPSK is compared with BPSK under varying SNR conditions.

Uploaded by

401-Arsh Alam
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
0% found this document useful (0 votes)
14 views6 pages

439-Lab 3 MWC

The document outlines a laboratory report on simulating a QPSK modulation scheme and analyzing its Bit Error Rate (BER) in an AWGN channel. It includes tasks for generating QPSK streams, performing modulation and demodulation, conducting BER analysis, implementing methods to reduce BER using Gray coding, and comparing QPSK with BPSK. The results demonstrate that Gray coding reduces BER compared to uncoded QPSK, and the performance of QPSK is compared with BPSK under varying SNR conditions.

Uploaded by

401-Arsh Alam
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/ 6

UNIVERSITY OF THE PUNJAB Mobile &

Wireless Communication (LAB) IEE&CE

NAME : Abdulelah Al-Suhaibi


ROLL NO : RP 20 EE 439
SUPMITTED TO: Engr. Rasmia Irfan
Lab 3

OBJECT:-
Simulate a QPSK modulation scheme and compute the system’s BER in AWGN.

Task 1
Generate an uncoded QPSK stream.
Code:
n=1000;
data=randi([0 1],n*4,1); %two bits per symbol
bitp=reshape(data,4,n);
qpsk=(2*bitp(:,1)-1)+1i*(2*bitp(:,2)-1);
qpsks=qpsk/sqrt(4);
stem(qpsks-4)
title('uncoded qpsk stream')
xlabel('symbols')
ylabel('apmlitute')
grid on

Task 2:
QPSK modulation and demodulation.
m=4;
n=100;
xn=randi([0 m-1],n,1);
sn=pskmod(xn,m);
subplot(2,1,1)
stem(real(sn));
title('real part of modulated QPSK stream');
xlabel('symbol index');
ylabel('Amplitute')
subplot(2,1,2)
stem(imag(sn),'r');
title('imaginary part of modulated QPSK stream');
xlabel('symbol index');
ylabel('Amplitute')

figure
snd=pskdemod(sn,m);
subplot(2,1,1)
stem(real(snd));
title('real part of demodulated QPSK stream');
xlabel('symbol index');
ylabel('Amplitute')
subplot(2,1,2)
stem(imag(snd),'r');
title('imaginary part of demodulated QPSK stream');
xlabel('symbol index');
ylabel('Amplitute')
Modulation graphs: Demodulation graphs

Task 3:
BER Analysis of QPSK under AWGN channel.

Code:
numSymbols = 50;
M = 4;
snrRange = -10:2:20;
data = randi([0 1], numSymbols*2, 1);
ber = zeros(size(snrRange));
for i = 1:length(snrRange)
qpsk = pskmod(data, M);
% Add AWGN
snr = snrRange(i);
qpskn = awgn(qpsk, snr, 'measured');
rdata = pskdemod(qpskn, M);
ber(i) = biterr(data, rdata) / numSymbols;
end
figure
subplot(2,2,1)
stem(qpsk)
title('transmitted signal')
xlabel('amplitude')
ylabel('symbol')
subplot(2,2,2)
stem(qpskn)
title('noisy signal')
xlabel('amplitude')
ylabel('symbol')
subplot(2,2,3)
stem(rdata)
title('recieved signal')
xlabel('amplitude')
ylabel('symbol')
% Plot BER vs SNR
semilogy(snrRange, ber, 'o-');
title('Bit Error Rate (BER) of QPSK under AWGN Channel');
xlabel('SNR (dB)');
ylabel('Bit Error Rate (BER)');
grid on;

Task 4:
Implement methods of reducing BER in Task 2 & 3, and explain the results briefly.
Using grey Coding method:

Code:
n = 100;
M = 4;
snrRange = -10:2:20;
data = randi([0 1], n*2, 1);
ber_no_coding = zeros(size(snrRange));
ber_gray_coding = zeros(size(snrRange));
for i = 1:length(snrRange)
qpskSymbols = pskmod(data, M);
snr = snrRange(i);
qpskSymbolsNoisy = awgn(qpskSymbols, snr, 'measured');
receivedData_no_coding = pskdemod(qpskSymbolsNoisy, M);
receivedData_gray_coding = pskdemod(qpskSymbolsNoisy, M, pi/4, 'gray');
ber_no_coding(i) = biterr(data, receivedData_no_coding) / (n * 2);
ber_gray_coding(i) = biterr(data, receivedData_gray_coding) / (n * 2);
end
semilogy(snrRange, ber_no_coding, 'o-', 'DisplayName', 'Without Coding');
hold on;
semilogy(snrRange, ber_gray_coding, 's-', 'DisplayName', 'With Gray Coding');
title('Bit Error Rate (BER) of QPSK under AWGN Channel');
xlabel('SNR (dB)');
ylabel('Bit Error Rate (BER)');
grid on;
legend;
hold off;
disp('Results:');
disp('1. Without Coding: BER is higher compared to Gray coding due to error
propagation.');
disp('2. With Gray Coding: BER is lower as it reduces the probability of symbol error.');

Task 5:
Simulate a QPSK modulation scheme and compare results with BPSK scheme.

Code:
n = 100;
M_QPSK = 4;
M_BPSK = 2;
snrRange = -10:2:20;
data = randi([0 1], n, 1);
data_QPSK = randi([0 1], n*2, 1);
ber_QPSK = zeros(size(snrRange));
ber_BPSK = zeros(size(snrRange));
for i = 1:length(snrRange)
qpskSymbols = pskmod(data_QPSK, M_QPSK);
bpskSymbols = pskmod(data, M_BPSK);
snr = snrRange(i); % Current SNR
qpskSymbolsNoisy = awgn(qpskSymbols, snr, 'measured');
bpskSymbolsNoisy = awgn(bpskSymbols, snr, 'measured');
receivedData_QPSK = pskdemod(qpskSymbolsNoisy, M_QPSK);
receivedData_BPSK = pskdemod(bpskSymbolsNoisy, M_BPSK);
ber_QPSK(i) = biterr(data_QPSK, receivedData_QPSK) / (n * 2);
ber_BPSK(i) = biterr(data, receivedData_BPSK) / n;
end

% Plot BER vs SNR for QPSK and BPSK


semilogy(snrRange, ber_QPSK, 'o-', 'DisplayName', 'QPSK');
hold on;
semilogy(snrRange, ber_BPSK, 's-', 'DisplayName', 'BPSK');
title('Bit Error Rate (BER) Comparison of QPSK and BPSK under AWGN Channel');
xlabel('SNR (dB)');
ylabel('Bit Error Rate (BER)');
grid on;
legend;
hold off;

You might also like