# I don't understand why my solve is solved at first followed by fields and inaccuracie/solved

f = 2.5E9; c = 3E8; lambda = c/f;
M=6; Mc=3;Mr=3;%3根通信天线，3根感知天线
A = 3;B = 3;%RIS行和列
N=A*B;
Pmax= 10000000;
beta_g=0.7;ac_BS_RIS = 0.2;%Gc的参数
beta_g=0.7;ar_BS_RIS = 0.2;%Gr
beta_hk=0.7;ak_RIS_UE = 0.2;%Hk
beta_he=0.7;ae_RIS_Eve = 0.2;%He
beta_dk=0.7;ack_BS_UE=0.2;%Dck
beta_de=0.7;ac_BS_Eve=0.2;%Dce
beta_de=0.7;ark_BS_UE=0.2;%Drk
beta_de=0.7;ar_BS_UE=0.2;%Dre

[BS_Pos, BS_y] = BS_Generation(lambda, M);%RIS和BS坐标
[RIS_Pos, RIS_y] = RIS_Generation(lambda,A,B);
User_Pos = [0,0]; User_y = 3; %UE坐标
Eve_Pos = [0,0]; Eve_y =15 ;%Eve坐标
[Gc,Gc_00,Gc_01,Gc_10,Gc_11] = channel_Gc(Mc,A,B,ac_BS_RIS,beta_g);%BS的Mc到RIS
[Gr,Gr_00,Gr_10] = channel_Gr(Mr,A,B,ar_BS_RIS,beta_g);%BS的Mr到RIS
[Hk,hk_00,hk_01,hk_10,hk_11] = channel_Hk(A,B,ak_RIS_UE,beta_hk);%RIS到UE
[He,he_00,he_01,he_10,he_11] = channel_He(A,B,ae_RIS_Eve,beta_he);%RIS到Eve
[Dck,dck_00,dck_01,dck_10,dck_11] = channel_Dck(ack_BS_UE, beta_dk, Mc);%BS的Mc到UE
[Dce,dce_00,dce_01,dce_10,dce_11] = channel_Dce(ac_BS_Eve, beta_de, Mc);%BS的Mc到Eve
[Drk,drk_00,drk_01,drk_10,drk_11] = channel_Drk(ark_BS_UE, beta_dk, Mr);%BS的Mr到UE
[Dre,dre_00,dre_01,dre_10,dre_11] = channel_Dre(ar_BS_UE, beta_de, Mr);%BS的Mr到Eve
[Ck_00,Ck_01,Ck_10,Ck_11,Ce_00,Ce_11,Re_0,Re_1,Rk_0,Rk_1]=CK_CE_Re_Rk(dce_00,dce_11,dck_00,dck_01,dck_10,dck_11,dre_00,dre_10,drk_00,drk_10,Gc_00,Gc_01,Gc_10,Gc_11,Gr_00,Gr_10,he_00,he_01,he_10,he_11,hk_00,hk_01,hk_10,hk_11);

S00 =normrnd(0, 0.0001, 3, 3);
S01 =normrnd(0, 0.0001, 3, 3);
A = 0.5*ULA_aM(0,3)ULA_aM(0,3)';
gamma00 = 1;%初始化
gamma10 = 1;
gammae00 = 1;
gammae10 = 1;
a0 = 1;
c0 = 1;
nk0 = 1;
nk1 = 1;
m=zeros(100);
for i=1:10%更新
if i~=1
gamma00 = gamma0;
gamma10 = gamma1;
gammae00 = gammae0;
gammae10 = gammae1;
a0 = a;
c0 = c;
nk0 = sqrt( real(trace(Ck_01
Wk_1)+trace(Rk_0’*Rq)+1)inv_pos(gamma0));
nk1 = sqrt( real(trace(Ck_10
Wk_0)+trace(Rk_1’*Rq)+1)*inv_pos(gamma1));
end
cvx_begin
variable alpha0 nonnegative %用户速率
variable beta0 nonnegative%窃听速率
variable Wk_0(3,3) complex semidefinite

variable Wk_1(3,3) complex semidefinite
variable Rq(3,3) complex semidefinite
% expression B(Mr,Mr)
% B = S00Wk_0S00’+S01Wk_1S01’+eye(Mr,Mr);
variable gamma0
variable gamma1
variable gammae0
variable gammae1
variable a nonnegative
variable b nonnegative
variable c nonnegative
variable d nonnegative
maximize(alpha0-beta0)%目标函数
subject to
%c1
real(trace(Wk_0) + trace(Wk_1) + trace(Rq)) <= Pmax;
%c3’
real(trace(ARqA’)) >= 0.4real(trace(S00Wk_0S00’+S01Wk_1S01’+eye(Mr,Mr)));
%c4
alpha0 <= log(1+gamma0)/log(2)+log(1+gamma1)/log(2);
%c5’
beta0>=log(1+gammae00)/log(2)+(gammae0-gammae00)inv_pos(1+gammae00)+log(1+gammae10)/log(2)+(gammae1-gammae10)inv_pos(1+gammae10);
%c6’
real(trace(Ck_00
Wk_0))>=0.5
(nk0
gamma0)^2 + 0.5*(real(trace(Ck_01Wk_1)+trace(Rk_0’Rq)+1)inv_pos(nk0))^2;
%c7’
real(trace(Ck_11
Wk_1))>=0.5
(nk1
gamma1)^2 + 0.5*(real(trace(Ck_10Wk_0)+trace(Rk_1’Rq)+1)inv_pos(nk1))^2;
%c12’
(gammae0+b)/2 >= norm([(gammae0-b)/2,a]‘,‘fro’);
%c13’
a0^2+2
a0
(a-a0) >= real(trace(Ce_00
Wk_0));
%c14
real(trace(Re_0Rq))+1>=b;
%c15
(gammae1+d)/2>=norm([(gammae1-d)/2,c]',‘fro’);
%c16
c0^2+2
c0*(c-c0) >= real(trace(Ce_11Wk_1));
%c17
real(trace(Re_1
Rq))+1>=d;
cvx_end
m(i) = alpha0-beta0;
if i==1
continue
end
if (m(i)-m(i-1))*inv_pos(m(i-1))<=0.0001%收敛
break
end
end
fenpei=real(trace(Wk_0) + trace(Wk_1) + trace(Rq));
plot(1:1:i,m(1:i),‘-or’,‘LineWidth’,2)

sorry，The picture should be at the bottom

Your program has terrible numerical scaling. Change units so that all non-zero input data is within a small number of orders of magnitude if 1.

Also, If you have access to Mosek, use it as solver. Otherwise, follow the instructions at CVXQUAD: How to use CVXQUAD’s Pade Approximant instead of CVX’s unreliable Successive Approximation for GP mode, log, exp, entr, rel_entr, kl_div, log_det, det_rootn, exponential cone. CVXQUAD’s Quantum (Matrix) Entropy & Matrix Log related functions