-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathIRS_MISO_fig4.m
153 lines (100 loc) · 2.14 KB
/
IRS_MISO_fig4.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
%centralized algorithm
%fig 4
clc
clear all
P=10^(5/10)/1000;%5dBm
P_noise=10^(-80/10)/1000;%-80dBm
M=8;N=50;
d0=51;
dv=2;
D=0;
%
% Hr_H=(randn(1,N)+1i*randn(1,N))/sqrt(2);%Rayleigh
% Hd_H=(randn(1,M)+1i*randn(1,M))/sqrt(2);%Rayleigh
for i=1:N
Hr_H(1,i)=1;%/sqrt(2)+1i/sqrt(2);
end
for i=1:M
Hd_H(1,i)=1;%/sqrt(2)+1i/sqrt(2);
end
kdb=1000;
k=10^(kdb/10);
g=sqrt(k/(k+1))+sqrt(1/(k+1)).*(randn(1,M)+1i*randn(1,M))/sqrt(2);%Rician
%g=zeros(1,M)+1;
for j=1:N
%20*log10(51) + 20*log10(28*10^6)-147.55=35.5446dB
%g2=g.*sqrt(10^(-3).*10^(5/10).*10^(-35.5446/10));
%g2=g.*sqrt(10^(-3).*10^(5/10)./(4*pi/10^(5/10)*d0^2));
g2=g.*sqrt(10^(-3).*10^(5/10).*d0^-2.2);
G(j,:)=g2;
end
for d=15:5:50
d_hr=sqrt((d0-d)^2+dv^2);%d2
d_hd=sqrt(d^2+dv^2);%d1
hr_H=Hr_H.*sqrt(10^(-3).*10^(-10/10).*10^(5/10).*d_hr^-3);
hr=hr_H';
hd_H=Hd_H.*sqrt(10^(-3).*10^(-10/10).*d_hd^-3);
hd=hd_H';
% hr_H=Hr_H.*10^(-1.5).*10^(-5/10).*d_hr^-1.5.*10^(2.5/10);
% hr=hr_H';
% hd_H=Hd_H.*10^(-1.5).*10^(-5/10).*d_hd^-1.5;
% hd=hd_H';
Phi=diag(hr_H)*G;
R_=[Phi*Phi' Phi*hd;hd_H*Phi' 0];
R=round(R_,15);
ishermitian(R)
%%%%%%%%%%%%
cvx_begin
variable V(N+1,N+1) symmetric
maximize(trace(R*V))
subject to
for n=1:N+1
V(n,n)==1;
end
V == semidefinite(N+1);
cvx_end
% cvx_begin
% variable V(N+1,N+1) symmetric
% maximize(trace(R*V));
% subject to
% diag(V)==1;
% V == semidefinite(N+1);
% cvx_end
%%%%%%%%%%%%
[U,W,Z] = svds(V);%V=U*W*Z'
obj_max=-100;
n=length(W);
for j=1:1000
r=sqrt(1/2)*(randn(n,1)+1i*randn(n,1));%sqrt(var/2)*(randn(1,N)+1i*randn(1,N))
v_=U*sqrt(W)*r;
obj=(v_'*R*v_);
if obj>=obj_max
obj_max=obj;
v_max=v_;
end
end
t=v_max(N+1);
for j=1:N
v(j,:)=exp(1i*angle(v_max(j)/t));
%v(j,:)=v_max(j)/t;
end
% for i=n+1:N
%
% v(i,:)=0;
%
% end
w=sqrt(P).*(v'*Phi+hd_H)'./norm(v'*Phi+hd_H);
obj_final=P*(norm(v'*Phi+hd_H))^2;
obj_final2=(abs((v'*Phi+hd_H)*w))^2;
SNR=10*log10(obj_final/P_noise);%dB
D=D+1;
SNR_re(D)=SNR;
end
hold on
plot([15:5:50],SNR_re)%d~SNR
grid on
xlabel('AP-user horizontal distance, d');
ylabel('Receive SNR (dB)');
title('Fig. 4 in the Paper');
axis([])
hold off