I have the following optimization problem.

\hspace{35pt}\max_{p_{n,k} w_{n,k}} t

subjected to

\hspace{35pt}t<= \sum_{n=1}^{{N_l}} w_{k,n} \log_2 \bigg(1 +\frac{p_{k,n} H_{k,n}} {w_{n,k} C}\bigg)

\hspace{35pt}p_{k,n}>=0

\hspace{35pt}w_{k,n}>=0

\hspace{35pt}sum(sum(p)) <= Pmax

\hspace{35pt}sum(w,2)<=1

p and w are my primal variables, rest are constants.

The term in the RHS of the constraint is concave as

\hspace{35pt}f = w \cdot \log_2(1+p/w)

is concave.

I am adding the 1st constraint in cvx in a loop

for k = 1:K

\hspace{35pt}t<= sum(

\hspace{35pt}w(:,k).*log(w(:,k).*c + p(:,k).*h(k)) -

\hspace{35pt}entr(w(:,k)) +

\hspace{35pt}(w(:,k).*log(c)))

end

But CVX is not allowing me to write this constraint. Can someone help me represent it in DCP complaint format?