# Error using cvx/log Disciplined convex programming error: Illegal operation: log( {convex} )

I’m trying to maximize the sum rate of all users, however, CVX gives me this error
Illegal operation: log( {convex} ).
cvx_begin
variables P1 P2 Puav T
variable y1
variable y2
variable y3
% Define y1, y2, and y3 using valid convex expressions
A1=Abs_Channel_squared(1,1);
A2=Abs_Channel_squared(1,2);
A3=Abs_Channel_squared(1,3);
A4=Abs_Channel_squared(2,1);
A5=Abs_Channel_squared(2,2);
A6=Abs_Channel_squared(2,3);
y1 = quad_over_lin(P1 * A1, P2 * A1 + Puav * A4 + square_pos(abs(noise)));
y2 = quad_over_lin(P2 * A2, Puav * A5 + square_pos(abs(noise)));
y3 = quad_over_lin(Puav * A6, P1 * A3 + P2 * A3 + square_pos(abs(noise)));
maximize(log(1 + y1) + log(1 + y2) + log(1 + y3))

``````subject to
% Constraint: Power of each user should be greater than or equal to 0
P1 >= 0
P2 >= 0
Puav >= 0
P1 + P2 + Puav <= Pmax
``````

cvx_end

You have violated CVX’s rules, because the argument of `log` must be concave. Moreover, the objective function is neither convex nor concave, as evidenced by `log(1+x^2/y)` being neither convex nor concave in `x` and `y`.

to avoid a non-convex optimization problem, I have to use Taylor expansion, so can I differentiate the problem inside the cvx?

You can do whatever you want to make the problem convex. It might not necessarily be a good idea.

Another option is to use a local or global non-convex solver under YALMIP on your original problem.