01 LAB Project PoC C
01 LAB Project PoC C
Faculty of Engineering
Laboratory Report Cover Sheet
Students must complete all details except the faculty use part.
Please submit all reports to your subject supervisor or the office of the concerned faculty.
1 Adnan 19-39561-1
Group Members:
Faculty comments___________________________________________________________________________
___________________________________________________________________________________________
American International University- Bangladesh (AIUB)
Faculty of Engineering
Principles of Communications
OBE Assessment Lab Project
Suppose, you want to send a message which contains your FULL NAME.
1. Convert the message to digital data.
2. Organize all binary data to send by serial transmission technique.
3. Convert digital data to digital signal using at least VAL1 sample data.
4. Now, modulate the digital signal (using QPSK or QAM) to send via a transmission channel.
5. Introduce some noise during transmission, assuming that the signal to noise ratio of the
channel is VAL2.
6. Demodulate the received signal.
7. Convert the binary data to retrieve the message.
8. Plot the signal at step 3, 4, 5, 6 and confirm if message in step 7 matches original message.
9. Find the threshold of SNR where transmitted signal starts getting distorted at the receiver.
Parameters:
Consider, your ID = AB-CDEFG-H.
VAL1 = EFB VAL2 = DH
Instructions:
1. Plagiarism is strictly prohibited.
2. Please use MATLAB software to accomplish the project.
3. Submit your lab project before the deadline.
4. Submission should be in PDF format. Add a cover page.
5. Finally submit it in the MS Teams assignment.
Mark distribution (to be filled by Faculty):
Project Attainment and Software Skill (Total Marks: 15)
Level (7.5-6) Level (5-3) Level (2-1) Secured
Objectives
(Proficient) (Good) (Acceptable) Marks
Only few
MATLAB All objectives are Objectives are satisfied at
objectives are
Coding satisfied major extent
satisfied
Results are attained at Only few results
Result All results are attained
major extent are attained
Viva Performance (Total Marks: 15)
Level (15-12) Level (11-6) Level (5-1) Secured
Name
(Proficient) (Good) (Acceptable) Marks
Capable to do the
Capable to do the Hardly capable to
analysis but cannot
analysis independently do the analysis
develop full system
Group 01 Member contributions:
No. Name ID Contributions
1 Adnan 19-39561-1 A. Code for Part 9 (looping)
B. Explanation of code of Part 9 (1st half)
2 Ruham Rofique 19-39473-1 A. Code for Step 1-2
B. Explanation of code of Step 1-2
3 Foisal Ahmed 19-39512-1 A. Code for Step 3-4
B. Explanation of code of Step 3-4
4 Md Mazharul Islam 19-39555-1 A. Introduction
B. Explanation of code of Step 5-6
5 Md. Shadman 19-39495-1 A. Code of Step 5-6
Shakif Bhuiyan B. Explanation of code of Part 9 (2nd half)
Introduction
Quadrature Phase Shift Keying (QPSK) is a form of Phase Shift Keying in which two bits are
modulated at once, selecting possible carrier phase shifts (0, 90, 180, or 270 degrees). QPSK uses
two carriers, one in-phase and the other quadrature but the amplitude is same for all. QPSK uses
four points on the constellation diagram, equal around a circle. With four phases, QPSK can
encode two bits per symbol. Instead of the conversion of digital bits into a series of digital stream,
it converts them into bit pairs. This decreases the data bit rate to half, which allows space for the
other users. QPSK allows the signal to carry twice as much information as ordinary PSK using
the same bandwidth. It provides high performance on bandwidth efficiency and bit error rate.
QPSK is used for wireless communication, mobile communication and satellite Communication.
Part 1:
Sending a message using QPSK modulation
In this step our job is to convert a word from strings into ASCII encoding from where it would be
converted into binary numbers. It will be done by with one input and one output. We will send the
bits of every ASCII encoded character one after another. It will maintain a serial. One convention
that needs to be established is whether the LSB or MSB of each code is sent first. The ASCII code
has seven bits, it is customary to send 8 bits per character and set the MSB to zero. If the
convention of sending the LSB first is used, the word “Alhamdulliah” is converted to the binary
data sequence. This is done by the help of our user-defined function “asc2bin” in MATLAB.
‘asc2bin’ function:
function dn = asc2bn(txt)
dec=double(txt) %Text to ASCII (decimal)
p2=2.^(0:-1:-7) % 2^0,2^-1,.......,2^-7
B=mod(floor(p2'*dec),2) %Decimal to binary conversion
%Columns of B are bits of chars
dn=reshape(B,1,numel(B));%Bytes to serial conbversion
end
Word to ASCII Decimal to Serial Binary Conversion code:
clc;
clear all;
close all;
% Group: 1
% Name: Adnan
% ID: 19-39561-1
% ID: AB-CDEFG-H
amplitude = 11;
freq = 1939;
VAL1 = 569;
VAL2 = 91;
% bit rate
f=freq; % carrier frequency
br=f/100;
bp=1/br;
Transmitted_Message= 'Alhamdulillah'
%Converting Information Message to bit%
x=asc2bn(Transmitted_Message); % Binary Information
Output of Step 1:
Transmitted_Message =
Alhamdulillah
dec =
65 108 104 97 109 100 117 108 105 108 108 97 104
p2 =
1.0000 0.5000 0.2500 0.1250 0.0625 0.0313 0.0156 0.0078
Output of Step 2:
We converted a text from string to a binary data sequence using ‘‘asc2bin’’ code in MATLAB.
The binary data sequence is then converted into a digital signal. Now in order to transmit the
signal, it must be converted into an analog signal.
In this case, we will perform QPSK modulation. QPSK: In quadrature phase shift keying, the
phase of the carrier signal is varied to create signal elements. Both frequency and amplitude
remain constant while the phase changes. In QPSK, 4 different phases are used for shift keying.
QPSK modulation code:
figure(2)
subplot(3,1,1);
plot(tt,y_in,'linewidth',3), grid on;
title(' wave form for inphase component in QPSK modulation ');
xlabel('time(sec)');
ylabel(' amplitude(volt0');
subplot(3,1,2);
plot(tt,y_qd,'linewidth',3), grid on;
title(' wave form for Quadrature component in QPSK modulation ');
xlabel('time(sec)');
ylabel(' amplitude(volt0');
subplot(3,1,3);
plot(tt,Tx_sig,'r','linewidth',3), grid on;
title('QPSK modulated signal (sum of inphase and Quadrature phase
signal)');
xlabel('time(sec)');
ylabel(' amplitude(volt0');
figure(1)
subplot(4,1,2);
plot(tt,Tx_sig,'r','linewidth',3), grid on;
title('QPSK modulated signal (sum of inphase and Quadrature phase
signal)');
xlabel('time(sec)');
ylabel(' amplitude(volt0');
axis([ 0 0.0275 -20 20]);
QPSK Modulated graph:
%Channel Noise%
Tx_sig_noise=awgn(Tx_sig,VAL2);
figure(1)
subplot(4,1,3);
plot(tt,Tx_sig_noise,'r'), grid on;
axis([ 0 0.0275 -20 20]);
xlabel('time(sec)');
ylabel('amplitude(volt)');
title('Received signal at Receiver');
bit=[];
for n=1:length(Rx_data);
if Rx_data(n)==1;
se=5*ones(1,VAL1);
else Rx_data(n)==0;
se=zeros(1,VAL1);
end
bit=[bit se];
end
t5=bp/VAL1:bp/VAL1:VAL1*length(Rx_data)*(bp/VAL1);
figure(1)
subplot(4,1,4)
plot(t5,bit,'LineWidth',2.5);grid on;
axis([ 0 bp*length(Rx_data) -.5 6]);
ylabel('amplitude(volt)');
xlabel(' time(sec)');
title('Demodulated signal at receiver');
B=
1 0 0 1 1 0 1 0 1 0 0 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0
0 1 0 0 1 1 1 1 0 1 1 0 0
0 1 1 0 1 0 0 1 1 1 1 0 1
0 0 0 0 0 0 1 0 0 0 0 0 0
0 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0 0 0 0 0
% Group: 1
% Name: Adnan
% ID: 19-39561-1
% ID: AB-CDEFG-H
amplitude = 11;
freq = 1939;
VAL1 = 569;
VAL2 = 91;
% bit rate
f=freq; % carrier frequency
br=f/100;
bp=1/br;
Transmitted_Message= 'Alhamdulillah'
%Converting Information Message to bit%
x=asc2bn(Transmitted_Message); % Binary Information
figure(2)
subplot(3,1,1);
plot(tt,y_in,'linewidth',3), grid on;
title(' wave form for inphase component in QPSK modulation ');
xlabel('time(sec)');
ylabel(' amplitude(volt0');
subplot(3,1,2);
plot(tt,y_qd,'linewidth',3), grid on;
title(' wave form for Quadrature component in QPSK modulation ');
xlabel('time(sec)');
ylabel(' amplitude(volt0');
subplot(3,1,3);
plot(tt,Tx_sig,'r','linewidth',3), grid on;
title('QPSK modulated signal (sum of inphase and Quadrature phase
signal)');
xlabel('time(sec)');
ylabel(' amplitude(volt0');
figure(1)
subplot(4,1,2);
plot(tt,Tx_sig,'r','linewidth',3), grid on;
title('QPSK modulated signal (sum of inphase and Quadrature phase
signal)');
xlabel('time(sec)');
ylabel(' amplitude(volt0');
axis([ 0 0.0275 -20 20]);
%Channel Noise%
Tx_sig_noise=awgn(Tx_sig,VAL2);
figure(1)
subplot(4,1,3);
plot(tt,Tx_sig_noise,'r'), grid on;
axis([ 0 0.0275 -20 20]);
xlabel('time(sec)');
ylabel('amplitude(volt)');
title('Received signal at Receiver');
bit=[];
for n=1:length(Rx_data);
if Rx_data(n)==1;
se=5*ones(1,VAL1);
else Rx_data(n)==0;
se=zeros(1,VAL1);
end
bit=[bit se];
end
t5=bp/VAL1:bp/VAL1:VAL1*length(Rx_data)*(bp/VAL1);
figure(1)
subplot(4,1,4)
plot(t5,bit,'LineWidth',2.5);grid on;
axis([ 0 bp*length(Rx_data) -.5 6]);
ylabel('amplitude(volt)');
xlabel(' time(sec)');
title('Demodulated signal at receiver');
amplitude = 11;
freq = 1939;
VAL1 = 569;
VAL2 = 91;
% bit rate
f=freq; % carrier frequency
br=f/100;
bp=1/br;
Transmitted_Message= 'Alhamdulillah'
%Converting Information Message to bit%
x=asc2bn(Transmitted_Message); % Binary Information
count = 0;
sending = [];
recieving = [];
gap = [];
SNR_dB = [];
loop_number = [];
match_gate = [];
snr = [];
%Channel Noise%
Tx_sig_noise=awgn(Tx_sig,VAL2);
Z_qd_intg=(trapz(t,Z_qd))*(2/T);%integration using
trapizodial rull
if (Z_qd_intg>0)% Decession Maker
Rx_qd_data=1;
else
Rx_qd_data=0;
end
bit=[];
for n=1:length(Rx_data);
if Rx_data(n)==1;
se=5*ones(1,VAL1);
else Rx_data(n)==0;
se=zeros(1,VAL1);
end
bit=[bit se];
end
t5=bp/VAL1:bp/VAL1:VAL1*length(Rx_data)*(bp/VAL1);
match = 0;
for i = 1:length(Transmitted_Message)
if Transmitted_Message(i) == Received_Message(i)
match = match+1;
else
match = match;
end
end
match;
if match == length(Transmitted_Message)
match_gate = [match_gate 1];
else
match_gate = [match_gate 0];
end
ratiod = 10^(VAL2/10);
snr = [snr real(round(ratiod))];
end
for i = 1:length(match_gate)
if (match_gate(i)==0 && match_gate(i+i)==1)
Threshold_SNR_dB = Info_loop(i+1,2);
break
end
end
Conclusion = sprintf('Threshold of SNR (dB): %.2f', Threshold_SNR_dB)
SNR_ratioo = 10^(Threshold_SNR_dB/10);
Conclusion = sprintf('Threshold of SNR (ratio): %12f', SNR_ratioo)