-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample7_08.m
More file actions
44 lines (31 loc) · 737 Bytes
/
Example7_08.m
File metadata and controls
44 lines (31 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
% File: Example7_08.m for Example 7-8
clear;
clf
ep = 0:-0.2:-7;
% Select the value of M
n = 8;
M = 2^n;
M1 = M;
SNRout = zeros(length(ep),1);
for (i = 1:1:length(SNRout))
Pe(i) = 10^(ep(i));
SNRout(i) = 3*M^2/(1+4*(M^2-1)*Pe(i));
end;
SNRoutdB1 = 10*log10(SNRout);
% Select the value of M
n = 3;
M = 2^n;
M2 = M;
SNRout = zeros(length(ep),1);
for (i = 1:1:length(SNRout))
SNRout(i) = 3*M^2/(1+4*(M^2-1)*Pe(i));
end;
SNRoutdB2 = 10*log10(SNRout);
%plot(ep,SNRoutdB);
semilogx(Pe,SNRoutdB1,'-',Pe,SNRoutdB2,'--');
xlabel('Pe -->');
ylabel('SNRoutdB -->');
axis([10^-7 1 0 60])
title(['(S/N)pk for PCM with M = ',num2str(M1),' (solid) and M = ',num2str(M2),' (dashed)']);
fprintf('\nCompare plot with Figure 7-17\n');