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
filename_mat = sprintf('results_v2_idx_%d.mat',idx);
load(filename_mat,'R');
% R is the full correlation matrix
% R(k+n*NUser+m*NUser*NTx,k'+n'*NUser+m'*NUser*NTx)
% where k .. User, n .. tx antenna, m .. Rx antenna
h_fig = figure(1);
set(h_fig,'Position',[360 504 560 104])
set(h_fig,'PaperPosition',[0.25 2.5 8 1.5])
cmap = colormap('gray');
cmap = cmap(end:-1:1,:);
%% calculate the Rx correlation matrix between users taking the first Rx antenna
n = 0:3;
m = 0;
for k1=0:3
for k2=0:3
tmp = R(k1+n*NUser+m*NUser*NTx+1,k2+n*NUser+m*NUser*NTx+1);
RRx(k1+1,k2+1) = mean(tmp(:));
end
end
subplot(1,3,1)
imagesc(abs(RRx))
set(gca,'xtick',1:4)
set(gca,'ytick',1:4)
colormap(cmap)
colorbar
xlabel('User')
ylabel('User')
%% calculate the Tx correlation matrix taking the first Rx antenna
k = 0:3;
m = 0;
for n1=0:3
for n2=0:3
tmp = R(k+n1*NUser+m*NUser*NTx+1,k+n2*NUser+m*NUser*NTx+1);
RTx(n1+1,n2+1) = mean(tmp(:));
end
end
subplot(1,3,2)
imagesc(abs(RTx))
set(gca,'xtick',1:4)
set(gca,'ytick',1:4)
colormap(cmap)
colorbar
xlabel('Tx antenna')
ylabel('Tx antenna')
%% calculate the Rx correlation matrix of the first user
n = 0:3;
k = 1;
for m1=0:1
for m2=0:1
tmp = R(k+n*NUser+m1*NUser*NTx+1,k+n*NUser+m2*NUser*NTx+1);
RRxUser(m1+1,m2+1) = mean(tmp(:));
end
end
subplot(1,3,3)
imagesc(abs(RRxUser))
set(gca,'xtick',1:2)
set(gca,'ytick',1:2)
colormap(cmap)
colorbar
xlabel('Rx antenna')
ylabel('Rx antenna')
filename_corr = fullfile(filepath_figs,sprintf('idx_%d_corr.eps',idx));
saveas(h_fig, filename_corr, 'epsc2');