-
Notifications
You must be signed in to change notification settings - Fork 2
/
main_Fig9.m
138 lines (116 loc) · 5.19 KB
/
main_Fig9.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
clear; clc;
rng(3);
tic;
% Parameters
nMonte = 5000; %5000;
NIs = 8:8:64; %8:8:64;
NGs = [1,2,4,8,0]; %[1,2,4,8,0];
NT = 2; % 2 or 8
PT = 10e-3; % Transmit power [W]
K = 1; % Rician factor
s2 = 1e-11; % Noise power
% Main loop
R = nan(nMonte,length(NIs),length(NGs),2);
parfor iMonte = 1:nMonte
if mod(iMonte,100) == 0
fprintf(['iMonte: ',num2str(iMonte),'\n'])
end
R_iter = nan(length(NIs),length(NGs),2);
for iNI = 1:length(NIs)
NI = NIs(iNI);
for iNG = 1:length(NGs)
NG = NGs(iNG);
% Generate channels hRT, hIT and hRI
[GRT,GRI,GIT] = func_path_gain();
hRI = sqrt(GRI) * sqrt(1/2) * (randn(1,NI) + 1i * randn(1,NI)); % Rayleigh
HIT_LoS = exp(1i * 2 * pi * rand(NI,NT));
HIT_NLoS = sqrt(1/2) * (randn(NI,NT) + 1i * randn(NI,NT));
HIT = sqrt(GIT) * (sqrt(K/(1+K)) * HIT_LoS + sqrt(1/(1+K)) * HIT_NLoS); % Rician
% Initialize w (3diag)
w = randn(NT,1) + 1i * randn(NT,1);
w = w / norm(w);
% Optimize Theta (3diag)
P_tmp = zeros(1,1e3);
for iIter = 1:1e3
hRIeff = hRI;
hITeff = HIT * w;
hRIeff_norm = hRIeff / norm(hRIeff);
hITeff_norm = hITeff / norm(hITeff);
[~, ~, T_tmp] = func_OPT_3diag(0, hITeff_norm, hRIeff_norm, NG);
w = (hRI*T_tmp*HIT)' / norm(hRI*T_tmp*HIT);
P_tmp(iIter+1) = (norm(hRI*T_tmp*HIT))^2; % same as abs(hRI*T_tmp*hIT*w)^2;
% Stopping condition
if (P_tmp(iIter+1) - P_tmp(iIter))/P_tmp(iIter) < 1e-4
break;
end
end
Theta_3diag = T_tmp;
% Initialize w (group)
w = randn(NT,1) + 1i * randn(NT,1);
w = w / norm(w);
% Optimize Theta (group)
P_tmp = zeros(1,1e3);
for iIter = 1:1e3
hRIeff = hRI;
hITeff = HIT * w;
hRIeff_norm = hRIeff / norm(hRIeff);
hITeff_norm = hITeff / norm(hITeff);
T_tmp = func_theta(hRIeff_norm,hITeff_norm,NG);
w = (hRI*T_tmp*HIT)' / norm(hRI*T_tmp*HIT);
P_tmp(iIter+1) = (norm(hRI*T_tmp*HIT))^2; % same as abs(hRI*T_tmp*hIT*w)^2;
% Stopping condition
if (P_tmp(iIter+1) - P_tmp(iIter))/P_tmp(iIter) < 1e-4
break;
end
end
Theta_group = T_tmp;
% Compute received signal power
R_iter(iNI,iNG,1) = log2(1 + PT * norm(hRI*Theta_3diag*HIT) ^ 2 / s2);
R_iter(iNI,iNG,2) = log2(1 + PT * norm(hRI*Theta_group*HIT) ^ 2 / s2);
end
end
R(iMonte,:,:,:,:) = R_iter;
end
R_av = squeeze(mean(R));
toc;
%% Plot
figure('defaultaxesfontsize',11)
LineW = 2; MarkS = 8;
hold on;
plot(NIs,R_av(:,5,1),'-p','linewidth',LineW,'MarkerSize',MarkS,'DisplayName','Tree-conn.')
plot(NIs,R_av(:,4,2),'-v','linewidth',LineW,'MarkerSize',MarkS,'DisplayName','Group-conn., group size 8')
plot(NIs,R_av(:,4,1),'--^','linewidth',LineW,'MarkerSize',MarkS,'DisplayName','Forest-conn., group size 8')
plot(NIs,R_av(:,3,2),'->','linewidth',LineW,'MarkerSize',MarkS,'DisplayName','Group-conn., group size 4')
plot(NIs,R_av(:,3,1),'--<','linewidth',LineW,'MarkerSize',MarkS,'DisplayName','Forest-conn., group size 4')
plot(NIs,R_av(:,2,2),'-s','linewidth',LineW,'MarkerSize',MarkS,'DisplayName','Group-conn., group size 2')
plot(NIs,R_av(:,2,1),'--d','linewidth',LineW,'MarkerSize',MarkS,'DisplayName','Forest-conn., group size 2')
plot(NIs,R_av(:,1,2),'-*','linewidth',LineW,'MarkerSize',MarkS,'DisplayName','Single-conn.')
grid on; box on;
xlabel('Number of RIS elements');
ylabel('Achievable rate [bps/Hz]');
set(gca,'GridLineStyle',':','GridAlpha',0.8,'LineWidth',1.5);
legend('location','southeast');
ax = gca;
ax.XTick = 0:8:64;
ax.XLim = [0 64];
set(gcf, 'Color', [1,1,1]);
set(gca, 'LineWidth',1.5);
% Add box
rectangle('Position',[27 3.9 10 1.2],'LineWidth',1.5)
axes('position',[.175 .615 .25 .25]);
hold on;
plot(NIs,R_av(:,5,1),'-p','linewidth',LineW,'MarkerSize',MarkS,'DisplayName','Tree-conn.')
plot(NIs,R_av(:,4,2),'-v','linewidth',LineW,'MarkerSize',MarkS,'DisplayName','Group-conn., group size 8')
plot(NIs,R_av(:,4,1),'--^','linewidth',LineW,'MarkerSize',MarkS,'DisplayName','Forest-conn., group size 8')
plot(NIs,R_av(:,3,2),'->','linewidth',LineW,'MarkerSize',MarkS,'DisplayName','Group-conn., group size 4')
plot(NIs,R_av(:,3,1),'--<','linewidth',LineW,'MarkerSize',MarkS,'DisplayName','Forest-conn., group size 4')
plot(NIs,R_av(:,2,2),'-s','linewidth',LineW,'MarkerSize',MarkS,'DisplayName','Group-conn., group size 2')
plot(NIs,R_av(:,2,1),'--d','linewidth',LineW,'MarkerSize',MarkS,'DisplayName','Forest-conn., group size 2')
plot(NIs,R_av(:,1,2),'-*','linewidth',LineW,'MarkerSize',MarkS,'DisplayName','Single-conn.')
grid on; box on;
set(gca,'GridLineStyle',':','GridAlpha',0.8,'LineWidth',1.5);
ylim([3.9 5.1]);
xlim([27 37]);
xticks(28:4:36)
set(gcf, 'Color', [1,1,1]);
set(gca, 'LineWidth',1.5);