-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwmmse.m
61 lines (59 loc) · 2.22 KB
/
wmmse.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
clear;
K = 4;
M = 4;
N = 2;
Q = 5;
I = 10;
SNRdB = 0;
SNR = 10^(SNRdB / 10);
P = SNR / Q;
r = 1000;
if K == 4
clusterLocations = [0 + 0j, ...
0 + r * 1j, ...
r * cos(pi / 6) + r * sin(pi / 6) * 1j, ...
-r * cos(pi / 6) + r * sin(pi / 6) * 1j];
elseif K == 7
clusterLocations = [0 + 0j, ...
0 + r * 1j, ...
r * cos(pi / 6) + r * sin(pi / 6) * 1j, ...
-r * cos(pi / 6) + r * sin(pi / 6) * 1j, ...
-r * 1j, ...
r * cos(pi / 6) + r * (sin(pi / 6) - 1) * 1j, ...
-r * cos(pi / 6) + r * (sin(pi / 6) - 1) * 1j];
end
closures = findClusterClosures(clusterLocations, r);
[bsLocations, ueLocations] = brownian(K, Q, I, clusterLocations, r / sqrt(3));
numCases = 100;
totalSumRate = 0;
totalNumIterations = 0;
maxIterations = 1e6;
epsilon = 1e-1;
rpcCase = zeros(numCases, 1);
for i = 1 : numCases
numIterations = 0;
prev = 0;
[bsLocations, ueLocations] = brownian(K, Q, I, clusterLocations, r / sqrt(3));
H = generateMIMOChannel(K, Q, M, bsLocations, I, N, ueLocations, 2);
[V, A] = generateRandomTxVector(K, Q, M, I, N, P, H, closures, 1);
[U, W, R, pc] = updateWMMSEVariables(K, Q, M, I, N, H, V);
while abs(prev - sum(R)) > epsilon
prev = sum(R);
numIterations = numIterations + 1;
if numIterations > maxIterations
numIterations = numIterations - 1;
break;
end
mmse = updateMmseMMatrix(K, Q, M, I, N, H, U, W);
V = iterateWMMSE(K, Q, M, I, N, mmse, P, H, W, U);
[U, W, R, pc] = updateWMMSEVariables(K, Q, M, I, N, H, V);
fprintf(2, 'sum rate @#%d in case#%d: %f\n', numIterations, i , sum(R));
end
rpcCase(i) = pc / (P * Q * K);
fprintf(2, 'Case #%d: R = %f, # = %d, rpc=%f\n', i, sum(R), numIterations, rpcCase(i);
totalSumRate = totalSumRate + sum(R);
totalNumIterations = totalNumIterations + numIterations;
end
fprintf(2, 'Avg sum rate: %f\n', totalSumRate / numCases);
fprintf(2, 'Avg number of iterations: %f\n', totalNumIterations / numCases);
fprintf(2, 'Avg relative power consumption: %f\n', mean(rpcCase));