Hello everyone, I am convexRIS, a blogger who focuses on code and explanations. With the rapid development of wireless communication technology, more and more wireless devices have poured into the Internet, which not only puts great pressure on increasingly scarce spectrum resources, but also causes energy consumption to continue to increase. Reconfigurable smart surface (RIS) has become a promising revolutionary technology in the next generation of wireless communications due to its low power consumption, low cost and reconfigurable wireless propagation environment. In recent years, academic circles have carried out sufficient discussions and research on RIS. This blog will explain and analyze the code ideas of an article about RIS and physical layer security. I hope you can like and support it!
论文题目:Secrecy Rate Maximization for Intelligent Reflecting Surface Assisted Multi-Antenna Communications
Published in journal: IEEE COMMUNICATIONS LETTERS
First, let’s briefly introduce the paper. This paper considers a RIS-assisted downlink secure transmission system, including a multi-antenna transmitter, a single-antenna user and a single-antenna eavesdropper (the author also discusses the situation of multi-antenna eavesdropping). Discussion, this code only considers single-antenna eavesdropping), and uses alternating optimization and MM algorithms to maximize the user's security rate. First set the system parameters:
Alice=[0,0];%BS location
IRS=[5,5];%IRS location
Bob=[30,0];%Bob location
Eve=[20,-20];%Eve location
M=3;%number of antennas at the Alice
P=db2pow(30)*1e-3;%maximum transmit power at the BS
sigmaB=db2pow(-79)*1e-3;%AWGN at the Bob
sigmaE=db2pow(-79)*1e-3;%AWGN at the Eve
C0=db2pow(-30);%path loss
kr=10;%rician factor
N=20;%IRS elements
epsilon=1e-4;%convergence threshold
Lmax=200;%maximum iteration number
Then the system parameters are modeled, the reflection link Rician channel, and the direct link Rayleigh channel. For convenience, the Los components in the Rician channel are all set to 1.
%% Channel
HAI=sqrt(C0*(1/norm(IRS-Alice)^2.2))*(sqrt(kr/(kr+1))*ones(N,M)+sqrt(1/(kr+1))*(sqrt(1/2)*randn(N,M)+sqrt(-1/2)*randn(N,M)));
hIB=sqrt(C0*(1/norm(IRS-Alice)^2.6))*(sqrt(kr/(kr+1))*ones(N,1)+sqrt(1/(kr+1))*(sqrt(1/2)*randn(N,1)+sqrt(-1/2)*randn(N,1)));
hIE=sqrt(C0*(1/norm(IRS-Eve)^2.6))*(sqrt(kr/(kr+1))*ones(N,1)+sqrt(1/(kr+1))*(sqrt(1/2)*randn(N,1)+sqrt(-1/2)*randn(N,1)));
hAB=sqrt(C0*(1/norm(Alice-Bob)^3.6))*(sqrt(1/2)*randn(M,1)+sqrt(-1/2)*randn(M,1));
hAE=sqrt(C0*(1/norm(Alice-Eve)^3.6))*(sqrt(1/2)*randn(M,1)+sqrt(-1/2)*randn(M,1));
After setting the channel parameters, it is necessary to prepare the relevant parameter settings for alternate optimization. First, set the number of iterations ite=0, an empty vector obj with all 0s to store the objective function, and initialize the RIS coefficient vector v:
ite=0;%initialize iteration number
obj=zeros(1,Lmax);%store objective value in each iteration
v=ones(N,1);%initialize RIS coefficients
Then, the first sub-problem is to optimize the base station beamforming vector w given the RIS coefficient. Here the paper gives a closed-form solution of w:
%% step1:optimize w
hB=HAI'*diag(v')*hIB+hAB;
hE=HAI'*diag(v')*hIE+hAE;
A=P*(hB*hB')+sigmaB*eye(M);
B=P*(hE*hE')+sigmaE*eye(M);
[V,D]=eig(A,B);
[~,idx]=max(abs(diag(D)));
w=V(:,idx);
w=P*w/norm(w);
After obtaining the closed-form solution of beamforming at the base station, start optimizing the phase of the RIS. Similarly, the optimization problem can be equivalent to maximizing SINR, which is also equivalent to minimizing the reciprocal of SINR:
Then, using Dinkelbach and introducing auxiliary variables , the problem is restructured as:
Obviously, after expanding the square terms and merging similar terms, the optimization problem can be transformed into minimizing a quadratic form. According to the MM principle, the upper bound of the quadratic form can be found and the problem can be reconstructed:
Obviously, when each element of the vector has the same phase as the corresponding element of the vector, the optimal solution can be obtained:
It is worth noting that it will change with the change of , so the paper claims that the semi-closed form expression of the RIS phase is obtained, which is a quasi-closed form solution. The code for sub-question 2 is as follows:
%% step2:optimize v
iteDin=0;
objDin=zeros(1,Lmax);
mu=0;
aB=diag(hIB')*HAI*w;
aE=diag(hIE')*HAI*w;
a_B=hAB'*w;
a_E=hAE'*w;
v_=v;
while 1
iteMM=0;
objMM=zeros(1,Lmax);
Phi=aE*aE'-mu*(aB*aB');
[phi1,eigphi,phi2]=svd(Phi);
while 1
beta=(eigphi(1,1)*eye(N)-Phi)*v_+mu*a_B'*aB-a_E'*aE;
v=exp(1i*angle(beta));
iteMM=iteMM+1;
objMM(iteMM)=norm(v-v_);
v_=v;
if iteMM>1 && (objMM(iteMM)<=epsilon*1e-1 || iteMM>=Lmax)
break
end
end
mu=(norm(v'*aE+a_E)^2+sigmaE)/(norm(v'*aB+a_B)^2+sigmaB);
iteDin=iteDin+1;
objDin(iteDin)=log2(1/mu);
if iteDin>1 && (abs(objDin(iteDin)-objDin(iteDin-1))/abs(objDin(iteDin-1))<=epsilon
|| iteDin>=Lmax)
break
end
end%endig of Dinkelbach
v=conj(v);
MM algorithm convergence performance:
Dinkelbach algorithm convergence performance:
Alternate optimization convergence performance:
That’s it for sharing in this issue. If you have any questions, please leave a message in the comments or send a private message. Thank you again for your support!