Hi,all.

I want to write the expression log(1/(1+x)),but there is a error: ‘Disciplined convex programming error:Illegal operation: rel_entr( {convex}, {convex} ).’

My code is shown as follows,

function [a,Theta,theta]= opt_Theta(w,W,lambda,Pmax,Rmin,P1)

load(‘channel.mat’,‘K’,‘N’,‘M’,‘ite’,‘pd’,‘ps’,‘pde’,‘pse’,‘Hbe’,‘Hd’,‘Hd_w’,‘Hbe_w’,‘theta_init’,‘AP_angle’,‘IRS_angle’,…‘G_sig’,‘User_angle’,‘Eve_angle’,‘Hie_sig’,‘Hr_sig’,‘eb1’,‘eb2’,‘path_du’,‘path_iu’,‘path_de’,‘path_ie’);

ite=100;

sigma_e = db2pow(-200);%噪声功率

sigma_u = db2pow(-200);

N1=1/sigma_u;

N2=1/sigma_e;

```
cvx_begin quiet
%variable Theta(N,N) complex
variable theta(1,N)
for t0=1:ite
Hd=pd*Hd_w(:,:,t0);
G=channel_G(AP_angle,IRS_angle,G_sig(:,:,t0),eb1,eb2,N,M);
Hr=ps*channel_Hr(User_angle,Hr_sig(:,:,t0),eb1,eb2,K,N);
Theta = diag(exp(1j*theta));
H=Hd+Hr*Theta*G;
Rateu=0;
for k0=1:K
P(k0)=norm(H(k0,:)*w);
sinr(k0)=norm(H(k0,:)*w)*N1;
y=sinr(k0);
Rateu=Rateu+rel_entr(1+y,y)+rel_entr(y,1+y)-rel_entr(1,y);
end
end
for t0=1:ite
Hbe=pde*Hbe_w(:,:,t0);
G=channel_G(AP_angle,IRS_angle,G_sig(:,:,t0),eb1,eb2,N,M);
Hie=pse*channel_Hie(Eve_angle,Hie_sig(:,:,t0),eb1,eb2,1,N);
Theta = diag(exp(1j*theta));
H_e=Hbe+Hie*Theta*G;
for k0=1:1
P=norm(H_e(k0,:)*w);
sinr(k0)=P*N2;
x=sinr(k0);
Ratee=rel_entr(1+x,x)+rel_entr(x,1+x)-rel_entr(1,x);
end
end
minimize (-(Rateu-Ratee-lambda*(P1+(w'*w))))
subject to
Rateu-Ratee>=Rmin;
for n=1:1:N
0<=theta(:,n)<2*pi;
end
cvx_end
Theta = diag(exp(1j*theta));
```

end

Who can explain the problem?Thank you.