How to handle log2 in CVX?

when I used CVX, the error is Undefined function or method ‘log2’ for input arguments of type ‘cvx’.

cvx_begin sdp quiet%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%CVX1开始(求解SDR 式22)
variable W1(3,3) hermitian

  max (u1*log2(1+trace(W1*H11)/(r12+sigmma(k)))-n*trace(W1*G1)-q21*trace(W1*H21)-m*trace(W1))
   subject to
  W1==hermitian_semidefinite(3);
 cvx_end%

In CVX, use log instead of log2. So use log(x)/log(2) in place of log2(x).

By the way, I have not addressed whether the rest of your formulation will be handled by CVX and do what you want - I have just addressed how to deal with log2.

2 Likes