Hello everyone,

I am using CVX for solving a convex optimization problem. The convexity of the problem mentioned in the paper. The objective function is concave and the nonlinear constraint is convex. The code I have written is as follows:

function [Rate,p,B,p_F,B_F] = CVXforRate(F,H,G,q,w,Phi,d,Beta,c,a)

```
global N_R N_T K N B B_F Delta N0 B_max P_max P_c0 P_cn T0 b_F mu_F mu P_F T T_E P_c
P0=0.5e-3; %mW, can change
T_E=(N_T*N*N_R+1)*T0;
P_E=P0*(1+N*N_T*N_R)*T0/T;
P_c = N*P_cn+P_c0+P_E;
n=2;
d=b_F*N/T;
Beta=1-T_E/T;
%Optimization problem to solve is as follows:
%_______________________________________________
% max log(Beta-d*g2(P_max-p,B_max-B))+log(g1(p,B))
% p,B
% s.t. 0 <= p <= P_max, 0 <= B <= B_max
% d/(B_max-B)*log(1+(P_max-p)*|h_F|^2/(B_max-B)*N_0)<= Beta
%_______________________________________________
cvx_begin
variables x(n) %x=[x1, x2]=[p,B]
g1=x(2)*log(1+x(1)*c/x(2));
g2=(1/(B_max-x(2))/log(1+a*(P_max-x(1))/(B_max-x(2))));
maximize ((log(Beta-d*g2))+log(g1)); %Objective function is a concave function
subject to
0 <= x(1) && x(1) <= P_max;
0 <= x(2) && x(2) <= B_max;
rdivide(d,(B_max-x(2))*log(1+rdivide((P_max-x(1))*abs(F)^2,((B_max-x(2))/N0)))) <= Beta;
cvx_end
p=x(1);
B=x(2);
p_F=P_max-x(1);
B_F=B_max-x(2);
Rate=cvx_optval;
end
```

The errors are as follows:

Error using .* (line 173)

Disciplined convex programming error:

Cannot perform the operation: {real affine} ./ {real affine}

Error in ./ (line 19)

z = times( x, y, ‘./’ );

Error in * (line 36)

z = feval( oper, x, y );

Error in / (line 15)

z = mtimes( x, y, ‘rdivide’ );

Error in CVXforRate (line 22)

g1=x(2)*log(1+x(1)*c/x(2));

Error in main (line 109)

[Rate,p,B,p_F,B_F] = CVXforRate(F,H,G,q,w,Phi,d,Beta,c,a)

I read the DCP ruleset and also common questions. My question is also among common question. However the paper I am simulating proved that objective function is concave.

Could you please help me with this error?

Thanks,

Best,

samaneh