-
Notifications
You must be signed in to change notification settings - Fork 2
/
E_WMMSE.m
73 lines (66 loc) · 2.29 KB
/
E_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
62
63
64
65
66
67
68
69
70
71
72
73
clc;clear;
K = 1; % 基站个数,此版本固定为1
T = 64; % 发射天线个数
R = 4; % 接收天线个数
epsilon = 1e-3; % 收敛条件
sigma2 = 1; % 噪声功率
snr = 20; % 信噪比
P = db2pow(snr)*sigma2; % 发射功率
beta = 0.5; %E-WMMSE的超参数
I = 16; % 用户个数
alpha1 = ones(I,K); % 权重系数,都假设相同
d = 2; % 假设每个用户都有d条路独立的数据流
max_iter = 100;
tic;
% 初始化信道向量
H = zeros(R,T,I); % 信道系数 用户数量*每个用户天线数量*基站天线数量
for i=1:I
H(: , :, i)=sqrt(1/2)*(randn(R,T)+1i*randn(R,T)); % 圆复高斯信道
end
rate = []; % 初始化一个空向量记录rate
% 初始化W和U矩阵
U =randn(R,d,I) + 1j*randn(R,d,I);
W = zeros(d,d,I);
for i=1:I
W(:,:,i)=eye(d,d);
end
% 初始化波束赋形矩阵
V = zeros(T,d,I); % 每个基站的波束赋形矩阵
for i=1:I
v = sqrt(1/2)*(randn(T,d)+1i*randn(T,d));
V(:,:, i) = sqrt(P/(I*trace(v*v')))*v;
end
% 求初始化发射波束V后求系统和速率
rate_old = sum_rate(H,V,sigma2,R,I,alpha1);
rate = [rate rate_old];
V_list = []; % 初始化一个空向量记录V_list
iter1 = 1; % 迭代次数
while(1)
% E-WMMSE的EXTRAPOLATION TECHNIQUE,特殊的初始化
if iter1 >=3
Q = normalize_V(V_list(:,(iter1-2)*d + 1:(iter1-1)*d,:) + beta*(V_list(:,(iter1-2)*d + 1:(iter1-1)*d,:)-V_list(:,(iter1-3)*d + 1:(iter1-2)*d,:)),I, P);
elseif iter1 == 2
Q = V_list(:,(iter1-2)*d+1:(iter1-1)*d,:);
elseif iter1 == 1
Q = V;
end
U = find_U(H,Q,sigma2, P, R,I,d);
W = find_W(U,H,Q,R,I,d);
V = find_V(alpha1,H,sigma2,U,W,T, R, I,d ,P);
rate_new = sum_rate(H,V,sigma2,R,I,alpha1); % 计算和速率
V_list = [V_list V]; % 初始化一个空向量记录V_list
rate = [rate rate_new];
iter1 = iter1 + 1;
if abs(rate_new-rate_old) / rate_old < epsilon || iter1 > max_iter
break;
end
rate_old = rate_new;
end
toc;
plot(0:iter1-1,rate,'r-o')
grid on
xlabel('Iterations')
ylabel('Sum rate (bits per channel use)')
set(gca,'GridLineStyle',':','GridColor','k','GridAlpha',1)
title('WMMSE, K=1, T=64, R=4, D=1, 10dB, \epsilon=1e-3','Interpreter','tex')
%title('SISO-IFC, K=3, T=1, R=1, \epsilon=1e-3','Interpreter','tex')