How to solve the error:Cannot perform the operation: {real affine} .* {convex}

The code is as follows:
%%set parameters
a=9.61;
b=0.16;
c=3e8;
f0=2e9;
eta_los=1;
eta_nlos=20;
n0=1e-17;
B=2e7;
Pc=0.5;
xu=250;
yu=250;
hu=50;
%%
r=sqrt((x3-xu).^2+(y3-yu).^2);
d=sqrt(r.^2+hu^2);
thita=atan(hu./r);
p_los=1./(1+aexp(-b(180/pi.thita-a)));
p_nlos=1-p_los;
sunhao=20
log10(4pif0.d/c)+p_loseta_los+p_nlos*eta_nlos;
mu=5e4;
num=400;
ncol=1;
T=poissrnd(mu,num,ncol);
alpha=(10.^(-sunhao/10))/n0;
%% cvx
cvx_begin
variables beita(400,1) pc(400,1);
maximize(sum(beita.*log2(1+pc.*alpha.*inv_pos(beita))))
subject to
beita.*log2(1+pc.*alpha.*inv_pos(beita))>=T
sum(beita)=B
sum(pc)=Pc
beita>=0
pc>=0
cvx_end
The optimization funticon is concave,so I use the maximize,but still exists error.Please help me!

Reformulate expressions of the form
`x*log(1+y/x)`
as
`-rel_entr(x,x+y)`

Thanks,Mark.Really appreciate!Although the result is NAN,the error has been sloved.I will continue to debug my program.

Hi，dear Mark，I am sorry to bother you again，I have changed my program according your suggestion，but the result is -Inf.Now,I am not sure I get it right.Can you take a look at it for me?Thanks very much!
%%set parameters
a=9.61;
b=0.16;
c=3e8;
f0=2e9;
eta_los=1;
eta_nlos=20;
n0=1e11;
B=2e7;
Pc=5e-4;
xu=250;
yu=250;
hu=50;
%%
r=sqrt((x3-xu).^2+(y3-yu).^2);
d=sqrt(r.^2+hu^2);
thita=atan(hu./r);
p_los=1./(1+aexp(-b(180/pi.thita-a)));
p_nlos=1-p_los;
sunhao=20
log10(4pif0.d/c)+p_loseta_los+p_nlos*eta_nlos;
mu=5e4;
num=400;
ncol=1;
T=poissrnd(mu,num,ncol);
alpha=(10.^(-sunhao/10))/n0;
%% cvx
cvx_begin
variables beita(400,1) pc(400,1);
maximize(sum(-rel_entr(beita,beita+pc.*alpha)))
subject to
-rel_entr(beita,beita+pc.*alpha)>=T
sum(beita)==B
sum(pc)==Pc
beita>=0
pc>=0
cvx_end

You didn’t account for the formulation i provided being in terms of `log`, whereas your expressions use `log2`.

I.e.,
Reformulate expressions of the form
`x*log2(1+y/x)`
as
`-rel_entr(x,x+y)/log(2)`

Lack of accounting for this in the objective won’t affect the argmax, but it does affect the constraint. By not accounting for this, your constraint is more constraining than it should be. So perhaps when you fix the constraint, the problem will become feasible (but maybe not).

I’m sorry Mark.The result is -Inf.I really have no idea.I don’t know how to solve the problem.Can you please help me check the program.
a=9.61;
b=0.16;
c=3e8;
f0=2e9;
eta_los=1;
eta_nlos=20;
n0=1e-17;
B=2e7;
Pc=50;
xu=250;
yu=250;
hu=50;
%%
r=sqrt((x3-xu).^2+(y3-yu).^2);
d=sqrt(r.^2+hu^2);
thita=atan(hu./r);
p_los=1./(1+aexp(-b(180/pi.thita-a)));
p_nlos=1-p_los;
sunhao=20
log10(4pif0.d/c)+p_loseta_los+p_nlos*eta_nlos;
mu=5e4;
num=400;
ncol=1;
T=poissrnd(mu,num,ncol);
alpha=(10.^(-sunhao/10))/n0;
%% cvx
cvx_begin
variables beita(400,1) pc(400,1);
maximize(sum(-rel_entr(beita,beita+pc.alpha)/log10(2)))
subject to
-rel_entr(beita,beita+pc.alpha)/log10(2)>=T;
sum(beita)==B;
sum(pc)==Pc;
beita>=0;
pc>=0;
cvx_end
The beita,pc are the optimization variables,both of them are 400
1 matrix.T is a 400
1 constant matrix.B and Pc are constants.The optimization function is concave and I want to get the maximization of the function.