H and W are positive semidefinite matrix.
I don’t understand why I am getting these errors.
Can anyone help me?
/////////////////////////////////////////////////////////////////////////////////////
Error using cvxprob/newobj
Expressions in objective functions must be real.

Error in maximize (line 21)
newobj( prob, ‘maximize’, x );

Error in sum_rate (line 56)
maximize(trace(H*W))
/////////////////////////////////////////////////////////////////////////////////////
How can I handle this problem?

The roundoff level imaginary term cab be eliminated by maximize(real(trace(H*W)))

BTW, the statement W >= 0 is redundant, because W was already declared to be semidefinite.

In the future, please copy and paste code using preformatted text icon, rather than posting an image of the code. That allows readers to copy and paste the code into their own MATLAB session.

@Mark_L_Stone Thank you for your answer
Given that both matrices are in the form A*(A_hermitian), by using real(), will I not lose my information in the objective function?

Sure.
my code:

cvx_begin sdp
variable W(N,N) complex semidefinite
maximize(real(trace(H*W)))
subject to
for i = 1:N
trace(B(:,:,i)*W) == 1
end

Hi, jangalok. The trace of matrix H*W is generally a complex value; therefore, you must clarify which part you need to maximize (real, imaginary, or modulo).