The objective function is trace of the product of two matrices, the code in matlab is:
maximize (trace(F * theta_relax))
but the matrices are complex, the objective function is complex. When I run the code, the matlab says: “Expressions in objective functions must be real.” So how to redefine the objective function, can I use the real function to make the value of the objective function a real number?
This is the modified code :
maximize (real(trace(F * theta_relax)))
The objective function is complex (not real), how to express it in matlab
CVX allows you to use real(...) wherever you want.
But it’s “your” problem (in the sense you’re the one who extracted that problem from a paper or book)… So you’ll have to decide what the objective should be. Which is greater 2+3i or 3+2i? An objective function needs to evaluate to a real scalar.