It gives error
??? Error using ==> cvxprob.newobj at 43
Expressions in objective functions must be real.

Error in ==> maximize at 21
newobj( prob, ‘maximize’, x );
NOTE: Phi{m-1} is written as i will be doing it iteratively but in each iteration I will have phi{m-1} as 64 X 64 matrix.
Thanks in advance

As the subject says, the objective function must be real. Now, if Phi is itself hermitian, then mathematically the trace will be real. But in practice, due to roundoff error, it may not be. Just take the real part, by wrapping the trace with a real function, and you should be fine.

The only variable you have declared is W, which is a scalar. I presume you want W to be a matrix constrained to be semidefinite. The statement W=w'*w which is executed prior to CVX being invoked, will be overriden (superseded) by variable W(1,1), which declares W as a 1 by 1, i.e., scalar, CVX variable. That is, the statement W=w'*w w accomplishes nothing in your program, because variable W(1,1) is used instead when it matters in the CVX program.

Do you even want to declare or use W at all in your program? Perhaps you want to declare w as a vector (complex?) variable, and use w'*w in place of W in your program? If so, then you would not need to constrain W to be semidefinite, because it would automatically hold by construction.

Yes exactly, w is complex. for start I’ve assumed I have just one beamforming vector which is a complex one and w’*w is a scalar now. if I have w with several arrays (more than one) then W will be matrix. So, I think for this step W as a scalar is good. Am I right?

I have no idea, because I don’t know what optimization problem you intend to solve.

Perhaps you should write out very carefully the mathematical specification of the optimization problem you wish to solve. Then, construct MATLAB and CVX code to implement that model. if you do thqt even if you don’t show it to anyone else, you will hopefully benefit from the clarity it brings to you, and the discipline it imposes on you.

Your answer did solve my problem but I don’t understand why with maximizing just the real part the problem is solved. For instance, why we don’t consider ‘abs’ since it includes both real and imaginary part…

That is a subject matter domain question, which is not suited for this forum. it’s up to you to figure out what optimization problem to formulate, and the relation between its solution and any real-world application. You will need to seek assistance form subject matter experts - perhaps a professor if you are a student? Or study books and papers.