-
Notifications
You must be signed in to change notification settings - Fork 2
/
simulationFigure1_2.m
374 lines (271 loc) · 11.2 KB
/
simulationFigure1_2.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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
%This Matlab script can be used to generate Figs. 1 and 2 in the article:
%
%Victor Croisfelt Rodrigues, Jose Carlos Marinello, and Taufik Abrao.
%"Exponential Spatial Correlation with Large-Scale Fading Variations in
%Massive MIMO Channel Estimation". Trans Emerging Tel Tech. 2019;e3563.
%
%Download paper: https://doi.org/10.1002/ett.3563
%
%This is version 2.0 (Last edited: 04-09-2019)
%
%License: This code is licensed under the GPLv3 license. If you in any way
%use this code for research that results in publications, please reference
%our original article as shown above.
%
%References:
%[1] Emil Bjornson, Jakob Hoydis and Luca Sanguinetti (2017), "Massive MIMO
%Networks: Spectral, Energy, and Hardware Efficiency", Foundations and
%Trends in Signal Processing: Vol. 11, No. 3-4, pp. 154-655. DOI: 10.1561/
%2000000093 (https://github.com/emilbjornson/massivemimobook).
%
%Initialization
close all;
clearvars;
%% Simulation parameters
%Choose the desired simulation subfigure:
% simulation == 1: (a) r varying
% simulation == 2: (b) sigma varying
%
simulation = 1;
%Number of BS antennas
M = 100;
if simulation == 1
%Correlation factor (r) in the exponential correlation model (range)
corrFactorRange = [0 0.25 0.5 0.75 0.99 1];
%Standard deviation [dB] of large-scale fading (LFS) variations over
%the array (range)
stdLFSrange = 0;
%Extract the number of different evaluated scenarios
nbrOfScenarios = length(corrFactorRange);
elseif simulation == 2
%Correlation factor (r) in the exponential correlation model (range)
corrFactorRange = 0;
%Standard deviation [dB] of large-scale fading (LFS) variations over
%the array (range)
stdLFSrange = [0 2 4 6 8];
%Extract the number of different evaluated scenarios
nbrOfScenarios = length(stdLFSrange);
end
%Generate the range of nominal AoAs (Note: these variables define the Monte
%Carlo average through the realizations of i.i.d. random variables related
%to the randomness of the system; therefore, you must tuning these
%parameters according to the desired accuracy)
thetaULAradians = linspace(-pi,+pi,10001); %aiming the average equality
thetaRadians = linspace(-pi,pi,101); %azimuth
varphiRadians = linspace(-pi/2,pi/2,101); %elevation
%% Simulation
%Prepare to save simulation results
eigenvalues_ULA = zeros(M,length(thetaULAradians)-1,nbrOfScenarios);
eigenvalues_UPA = zeros(M,length(thetaRadians)-1,length(varphiRadians)-1,nbrOfScenarios);
%Go through all different scenarios
for scn = 1:nbrOfScenarios
%Display simulation progress
disp([num2str(scn) ' scenarios out of ' num2str(nbrOfScenarios)]);
if simulation == 1
%Extract the current correlation factor value
corrFactor = corrFactorRange(scn);
stdLSF = stdLFSrange; %just repeat the stdLSF
elseif simulation == 2
%Extract the current LSF standard deviation value
stdLSF = stdLFSrange(scn);
corrFactor = corrFactorRange; %just repeat the correlation factor
end
%Go through all azimuthal angles
for az = 1:length(thetaULAradians)-1
%Generate covariance matrix with the exponential correlation model with
%fading variations along the array for the uniform linear array (ULA)
R_ULA = functionExpLSF_ULA(M,thetaULAradians(az),corrFactor,stdLSF);
%Save simulation results for ULA
eigenvalues_ULA(:,az,scn) = sort(eig(R_ULA),'descend');
end
%Go through all azimuthal angles
for az = 1:length(thetaRadians)-1
%Go through all elevation angles
for el = 1:length(varphiRadians)-1
%Generate covariance matrix with the exponential correlation model with
%fading variations along the array for the uniform planar array (UPA)
R_UPA = functionExpLSF_UPA(M,thetaRadians(az),varphiRadians(el),corrFactor,stdLSF);
%Save simulation results for UPA
eigenvalues_UPA(:,az,el,scn) = sort(eig(R_UPA),'descend');
end
end
end
%% Plot simulation results
if simulation == 1
%ULA
figure;
hold on; box on;
%Prepare to store y values
y = zeros(M,nbrOfScenarios);
%Go through all different scenarios
for scn = 1:nbrOfScenarios
%Extract the y values
y(:,scn) = real(mean(eigenvalues_ULA(:,:,scn),2));
end
%Plot referece markers
plot(1,y(1,1),'h--','LineWidth',1);
plot(1,y(1,2),'*--','LineWidth',1);
plot(1,y(1,3),'s--','LineWidth',1);
plot(1,y(1,4),'d--','LineWidth',1);
plot(1,y(1,5),'^--','LineWidth',1);
plot(1,y(1,6),'p--','LineWidth',1);
%Reset the colors
ax = gca;
ax.ColorOrderIndex = 1;
%Plot the lines
plot(1:M,y(:,1),'--','LineWidth',1);
plot(1:M,y(:,2),'--','LineWidth',1);
plot(1:M,y(:,3),'--','LineWidth',1);
plot(1:M,y(:,4),'--','LineWidth',1);
plot(1:M,y(:,5),'--','LineWidth',1);
plot(1:M,y(:,6),'--','LineWidth',1);
%Reset the colors
ax = gca;
ax.ColorOrderIndex = 1;
%Plot the missing markers
plot(10:10:M,y(10:10:M,1),'h','LineWidth',1);
plot(10:10:M,y(10:10:M,2),'*','LineWidth',1);
plot(10:10:M,y(10:10:M,3),'s','LineWidth',1);
plot(10:10:M,y(10:10:M,4),'d','LineWidth',1);
plot(10:10:M,y(10:10:M,5),'^','LineWidth',1);
plot(10:10:M,y(10:10:M,6),'p','LineWidth',1);
%Plot the uncorrelated reference line
plot(1:M,ones(M,1),'k:','LineWidth',1.5);
text(55,1.25,'Uncorrelated Rayleigh Fading')
xlabel('Eigenvalue number (decreasing order)');
ylabel('Average normalized eigenvalue');
legend('$r = 0$','$r = 0.25$','$r = 0.5$','$r = 0.75$','$r = 0.99$','r = 1','Location','NorthEast');
set(gca,'Yscale','log');
ylim([1e-3 1e3]);
clear y
%UPA
figure;
hold on; box on;
%Prepare to store y values
y = zeros(M,nbrOfScenarios);
%Go through all different scenarios
for scn = 1:nbrOfScenarios
%Extract the y values
y(:,scn) = real(mean(mean(eigenvalues_UPA(:,:,:,scn),2),3));
end
%Plot referece markers
plot(1,y(1,1),'h--','LineWidth',1);
plot(1,y(1,2),'*--','LineWidth',1);
plot(1,y(1,3),'s--','LineWidth',1);
plot(1,y(1,4),'d--','LineWidth',1);
plot(1,y(1,5),'^--','LineWidth',1);
plot(1,y(1,6),'p--','LineWidth',1);
%Reset the colors
ax = gca;
ax.ColorOrderIndex = 1;
%Plot the lines
plot(1:M,y(:,1),'--','LineWidth',1);
plot(1:M,y(:,2),'--','LineWidth',1);
plot(1:M,y(:,3),'--','LineWidth',1);
plot(1:M,y(:,4),'--','LineWidth',1);
plot(1:M,y(:,5),'--','LineWidth',1);
plot(1:M,y(:,6),'--','LineWidth',1);
%Reset the colors
ax = gca;
ax.ColorOrderIndex = 1;
%Plot the missing markers
plot(10:10:M,y(10:10:M,1),'h','LineWidth',1);
plot(10:10:M,y(10:10:M,2),'*','LineWidth',1);
plot(10:10:M,y(10:10:M,3),'s','LineWidth',1);
plot(10:10:M,y(10:10:M,4),'d','LineWidth',1);
plot(10:10:M,y(10:10:M,5),'^','LineWidth',1);
plot(10:10:M,y(10:10:M,6),'p','LineWidth',1);
%Plot the uncorrelated reference line
plot(1:M,ones(M,1),'k:','LineWidth',1.5);
text(55,1.25,'Uncorrelated Rayleigh Fading')
xlabel('Eigenvalue number (decreasing order)');
ylabel('Average normalized eigenvalue');
legend('$r = 0$','$r = 0.25$','$r = 0.5$','$r = 0.75$','$r = 0.99$','r = 1','Location','NorthEast');
set(gca,'Yscale','log');
ylim([1e-3 1e3]);
elseif simulation == 2
%ULA
figure;
hold on; box on;
%Prepare to store y values
y = zeros(M,nbrOfScenarios);
%Go through all different scenarios
for scn = 1:nbrOfScenarios
%Extract the y values
y(:,scn) = real(mean(eigenvalues_ULA(:,:,scn),2));
end
%Plot referece markers
plot(1,y(1,1),'h--','LineWidth',1);
plot(1,y(1,2),'*--','LineWidth',1);
plot(1,y(1,3),'s--','LineWidth',1);
plot(1,y(1,4),'d--','LineWidth',1);
plot(1,y(1,5),'^--','LineWidth',1);
%Reset the colors
ax = gca;
ax.ColorOrderIndex = 1;
%Plot the lines
plot(1:M,y(:,1),'--','LineWidth',1);
plot(1:M,y(:,2),'--','LineWidth',1);
plot(1:M,y(:,3),'--','LineWidth',1);
plot(1:M,y(:,4),'--','LineWidth',1);
plot(1:M,y(:,5),'--','LineWidth',1);
%Reset the colors
ax = gca;
ax.ColorOrderIndex = 1;
%Plot the missing markers
plot(10:10:M,y(10:10:M,1),'h','LineWidth',1);
plot(10:10:M,y(10:10:M,2),'*','LineWidth',1);
plot(10:10:M,y(10:10:M,3),'s','LineWidth',1);
plot(10:10:M,y(10:10:M,4),'d','LineWidth',1);
plot(10:10:M,y(10:10:M,5),'^','LineWidth',1);
%Plot the uncorrelated reference line
plot(1:M,ones(M,1),'k:','LineWidth',1.5);
text(55,1.25,'Uncorrelated Rayleigh Fading')
xlabel('Eigenvalue number (decreasing order)');
ylabel('Average normalized eigenvalue');
legend('$\sigma = 0$ dB','$\sigma = 2$ dB','$\sigma = 4$ dB','$\sigma = 6$ dB','$\sigma = 8$ dB','Location','NorthEast');
set(gca,'Yscale','log');
ylim([1e-3 1e3]);
%UPA
figure;
hold on; box on;
%Prepare to store y values
y = zeros(M,nbrOfScenarios);
%Go through all different scenarios
for scn = 1:nbrOfScenarios
%Extract the y values
y(:,scn) = real(mean(mean(eigenvalues_UPA(:,:,:,scn),2),3));
end
%Plot referece markers
plot(1,y(1,1),'h--','LineWidth',1);
plot(1,y(1,2),'*--','LineWidth',1);
plot(1,y(1,3),'s--','LineWidth',1);
plot(1,y(1,4),'d--','LineWidth',1);
plot(1,y(1,5),'^--','LineWidth',1);
%Reset the colors
ax = gca;
ax.ColorOrderIndex = 1;
%Plot the lines
plot(1:M,y(:,1),'--','LineWidth',1);
plot(1:M,y(:,2),'--','LineWidth',1);
plot(1:M,y(:,3),'--','LineWidth',1);
plot(1:M,y(:,4),'--','LineWidth',1);
plot(1:M,y(:,5),'--','LineWidth',1);
%Reset the colors
ax = gca;
ax.ColorOrderIndex = 1;
%Plot the missing markers
plot(10:10:M,y(10:10:M,1),'h','LineWidth',1);
plot(10:10:M,y(10:10:M,2),'*','LineWidth',1);
plot(10:10:M,y(10:10:M,3),'s','LineWidth',1);
plot(10:10:M,y(10:10:M,4),'d','LineWidth',1);
plot(10:10:M,y(10:10:M,5),'^','LineWidth',1);
%Plot the uncorrelated reference line
plot(1:M,ones(M,1),'k:','LineWidth',1.5);
text(55,1.25,'Uncorrelated Rayleigh Fading')
xlabel('Eigenvalue number (decreasing order)');
ylabel('Average normalized eigenvalue');
legend('$\sigma = 0$ dB','$\sigma = 2$ dB','$\sigma = 4$ dB','$\sigma = 6$ dB','$\sigma = 8$ dB','Location','NorthEast');
set(gca,'Yscale','log');
ylim([1e-3 1e3]);
end