-
Notifications
You must be signed in to change notification settings - Fork 0
/
simsumratefig5.m
87 lines (46 loc) · 1.3 KB
/
simsumratefig5.m
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
Gamma_barl=100;
N=10;
L=[2:2:20];
Npt=100000;
for j=1:Npt
for m=1:length(L)
Gamma_l=0;
for i=1:L(m)
alpha= raylrnd(1/sqrt(2),1,N);
beta= raylrnd(1/sqrt(2),1,N);
Al_Square= dot(alpha,beta)^2;
Gamma_l(i)=Al_Square*Gamma_barl;
end
snr1=max(Gamma_l);
snr2(j,m)=snr1;
end
end
avg_snr=mean(snr2);
logsnr10=log2(1+avg_snr);
plot(L,logsnr10,'k-*','MarkerFaceColor','auto');grid on;hold on;
xlabel("L")
ylabel("Average Sum Rate")
Gamma_barl=100;
N=20;
L=[2:2:20];
Npt=100000;
for j=1:Npt
for m=1:length(L)
Gamma_l=0;
for i=1:L(m)
alpha= raylrnd(1/sqrt(2),1,N);
beta= raylrnd(1/sqrt(2),1,N);
Al_Square= dot(alpha,beta)^2;
Gamma_l(i)=Al_Square*Gamma_barl;
end
snr1=max(Gamma_l);
snr2(j,m)=snr1;
end
end
avg_snr=mean(snr2);
logsnr20=log2(1+avg_snr);
plot(L,logsnr20,'g-*','MarkerFaceColor','auto');grid on;hold on;
xlabel("L")
ylabel("Average Sum Rate")
legend("N=10","N=20")
title("Average capacity vs L")