M.shoaib Matlab Assignment 3b
M.shoaib Matlab Assignment 3b
%generating QPSK symbol sequence of 20000 symbols & plotting the constellation
Result
1.5
0.5
0
Im
-0.5
-1
-1.5
-2
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
Re
%generating 8-PSK symbol sequence of 20000 symbols & plotting the constellation
>> konst_e8psk = exp(j*[pi/8 3*pi/8 5*pi/8 7*pi/8 9*pi/8 11*pi/8 13*pi/8 15*pi/8]);
Result
1.5
0.5
0
Im
-0.5
-1
-1.5
-2
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
Re
%generating 64-QAM symbol sequence of 20000 symbols & plotting the constellation
Result
0
Im
-2
-4
-6
-8
-8 -6 -4 -2 0 2 4 6 8
Re
%adding noise to the signal
nvqam = 2.0099
nvqpsk = 2.0108
svqpsk = 1.0000
svqam = 41.8193
p1 = std(qpsk)/(std(nqpsk)*10^(SNR/20));
plot(snqpsk,'o');
Result
0.5
-0.5
-1
-1.5
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
p2 = std(qam)/(std(nqam)*10^(SNR/20));
plot(snqam,'o');
Result
10
-2
-4
-6
-8
-10
-10 -8 -6 -4 -2 0 2 4 6 8 10
SNR = 15;
p1 = std(qpsk)/(std(nqpsk)*10^(SNR/20));
plot(snqpsk,'o');
Result
1.5
0.5
-0.5
-1
-1.5
-1.5 -1 -0.5 0 0.5 1 1.5
p2 = std(qam)/(std(nqam)*10^(SNR/20));
plot(snqam,'o');
Result
10
-2
-4
-6
-8
-10
-15 -10 -5 0 5 10
Similarly for SNR = 10;
Result
1.5
0.5
-0.5
-1
-1.5
-2
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
15
10
-5
-10
-15
-15 -10 -5 0 5 10 15
For SNR = 5; Result
-1
-2
-3
-2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5
20
15
10
-5
-10
-15
-20
-20 -15 -10 -5 0 5 10 15 20
% Signal Detection (symbol by symbol detection) for % QPSK
>>sn_block = repmat(snqpsk,1,4).';
>>konst_block = repmat(konst_qpsk,1,20000);
>>[y,ind_1] = min(distance)
>>y = 0.0015
>>ind_1 = 4593
>>qpsk_det = qpsk(ind_1)
%Using for loop to calculate sep_theo & sep_simu for SNR values 0 to 10 db
>>sep_theo = [0.2941 0.2401 0.1980 0.1513 0.1092 0.0753 0.0462 0.0246 0.0121 0.0049 0.0016];
>>sep_simu = [0.7516 0.7538 0.7405 0.7507 0.7459 0.7461 0.7474 0.7514 0.7461 0.7538 0.7530];
>> SNR=[0:10];
0.35
0.3
0.25
0.2
s eptheo
0.15
0.1
0.05
0
0 1 2 3 4 5 6 7 8 9 10
SNR
0.35
0.755
0.3
0.25
0.75
0.2
septheo
sepsimu
0.15
0.745
0.1
0.05
0.74
0
00 11 22 3
3 44 55 66 7 7 8 8 9 9 10 10
SNR
SNR
% 64-QAM (results and graphs)
sep_theo = [0.3513 0.2740 0.2057 0.1432 0.0905 0.0509 0.0251 0.0106 0.0037 9.1196e-004 2.0702e-004];
sep_simu = [0.3458 0.2747 0.2049 0.1391 0.0910 0.0505 0.0240 0.0102 0.0037 0.0013 5.0000e-004];
SNR=[15:25];
plot(SNR, sep_theo); xlabel('SNR'); ylabel(' septheo '); grid on;
figure; plot(SNR, sep_simu); xlabel('SNR'); ylabel(' sepsimu '); grid on;
Results for sep_theo and sep_simu
0.4
0.35
0.3
0.25
s eptheo
0.2
0.15
0.1
0.05
0
15 16 17 18 19 20 21 22 23 24 25
SNR
0.35
0.3
0.25
0.2
s eps im u
0.15
0.1
0.05
0
15 16 17 18 19 20 21 22 23 24 25
SNR
Answers to questions asked in assignment
1) Amplitudes and Phases for 8-QAM:
When using QAM, the constellation points are normally arranged in a square grid with equal vertical and
horizontal spacing and as a result the most common forms of QAM use a constellation with the number
of points equal to a power of 2 i.e. 2, 4, 8, 16 . . . .To provide an example of how QAM operates the table
below provides the bit sequences, and the associated amplitude and phase states. From this it can be
seen that a continuous bit stream may be grouped into threes and represented as a sequence of eight
permissible states.
The two methods are same in nature but different in implementation. One is based on statistical behavior of
communication channel, noise, computation etc, while other one is actually performing the experiment in an in-
deterministic way. And so are their results different.