-
Notifications
You must be signed in to change notification settings - Fork 5
/
main_Fig3.m
103 lines (89 loc) · 3.61 KB
/
main_Fig3.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
% Compute received power with analytical solution.
% * SISO systems with direct link.
% * Single, group, and fully connected RISs.
clear; clc;
rng(3);
tic;
% Parameters
nMonte = 500; %5000
MIs = 1:66; %1:66;
MGs = [1,2,3,4,0]; %[1,2,3,4,0];
PT = 10; % Transmit power [W]
K = 0; % Rician factor
% Main loop
PR = nan(nMonte,length(MIs),length(MGs),2);
for iMonte = 1:nMonte
if mod(iMonte,100) == 0
fprintf(['iMonte: ',num2str(iMonte),'\n'])
end
for iMI = 1:length(MIs)
NI = 2* MIs(iMI);
% Generate channels hRT, hIT and hRI
[GRT,GRI,GIT] = func_path_gain_transmissive_mode();
hRT_LoS = exp(1i * 2 * pi * rand(1));
hRT_NLoS = sqrt(1/2) * (randn(1) + 1i * randn(1));
hRT = sqrt(GRT) * (sqrt(K/(1+K)) * hRT_LoS + sqrt(1/(1+K)) * hRT_NLoS); % Rician
hRI_LoS = exp(1i * 2 * pi * rand(1,NI));
hRI_NLoS = sqrt(1/2) * (randn(1,NI) + 1i * randn(1,NI));
hRI = sqrt(GRI) * (sqrt(K/(1+K)) * hRI_LoS + sqrt(1/(1+K)) * hRI_NLoS); % Rician
hIT_LoS = exp(1i * 2 * pi * rand(NI,1));
hIT_NLoS = sqrt(1/2) * (randn(NI,1) + 1i * randn(NI,1));
hIT = sqrt(GIT) * (sqrt(K/(1+K)) * hIT_LoS + sqrt(1/(1+K)) * hIT_NLoS); % Rician
% Transmissive mode
hRI(1:2:end) = 0;
hIT(2:2:end) = 0;
% Normalize channels hIT and hRI
hRI_norm = hRI / norm(hRI);
hIT_norm = hIT / norm(hIT);
for iMG = 1:length(MGs)
NG = 2 * MGs(iMG);
if mod(NI,NG) == 0 || NG == 0
% Compute Theta
Theta = func_theta(hRI_norm,hIT_norm,NG);
Theta = exp(1i * angle(hRT)) * Theta;
% Compute received signal power
PR(iMonte,iMI,iMG,1) = PT * abs(hRT + hRI*Theta*hIT) ^ 2;
PR(iMonte,iMI,iMG,2) = PT * (sqrt(func_upper_bound_GC(hIT, hRI, NG)) + abs(hRT)) ^ 2;
end
end
end
end
PR_av = squeeze(mean(PR));
toc;
%% Plot
figure('DefaultAxesFontSize',12); hold on;
LineW = 1.5;
MarkS = 8;
plot(MIs(8:8:64),PR_av(8:8:64,5,2)*1e6,'-h','linewidth',LineW,'MarkerSize',MarkS)
plot(MIs(8:8:64),PR_av(8:8:64,5,1)*1e6,'--p','linewidth',LineW,'MarkerSize',MarkS)
plot(MIs(8:8:64),PR_av(8:8:64,4,2)*1e6,'-v','linewidth',LineW,'MarkerSize',MarkS)
plot(MIs(8:8:64),PR_av(8:8:64,4,1)*1e6,'--^','linewidth',LineW,'MarkerSize',MarkS)
plot(MIs(12:6:66),PR_av(12:6:66,3,2)*1e6,'->','linewidth',LineW,'MarkerSize',MarkS)
plot(MIs(12:6:66),PR_av(12:6:66,3,1)*1e6,'--<','linewidth',LineW,'MarkerSize',MarkS)
plot(MIs(8:8:64),PR_av(8:8:64,2,2)*1e6,'-s','linewidth',LineW,'MarkerSize',MarkS)
plot(MIs(8:8:64),PR_av(8:8:64,2,1)*1e6,'--d','linewidth',LineW,'MarkerSize',MarkS)
plot(MIs(8:8:64),PR_av(8:8:64,1,2)*1e6,'-*','linewidth',LineW,'MarkerSize',MarkS)
plot(MIs(8:8:64),PR_av(8:8:64,1,1)*1e6,'--o','linewidth',LineW,'MarkerSize',MarkS)
grid on;
if K == 0
title('Rayleigh fading')
else
title('Rician fading - Rician factor = 3 dB')
end
xlabel('Number of RIS cells');
ylabel('Average received signal power [uW]')
legend('CW-FC - Upper Bound','Alg. 1',...
'CW-GC (Group Size 4) - Upper Bound','Alg. 1',...
'CW-GC (Group Size 3) - Upper Bound','Alg. 1',...
'CW-GC (Group Size 2) - Upper Bound','Alg. 1',...
'CW-SC - Upper Bound','Alg. 1',...
'location','northwest','numColumns',2);
plots=get(gca, 'Children');
legend(plots([10,8,6,4,2,9,7,5,3,1]));
ax = gca;
ax.XTick = 0:8:64;
ax.XLim = [0 64];
ax.YTick = 0:0.2:1.2;
ax.YLim = [0 1.2];
set(gcf, 'Color', [1,1,1]);
set(gca, 'LineWidth',1);