Complex angle constraints

I wanted to use the Matlab function angle (the complex argument) in CVX. Since this is not implemented for CVX objects, I added the following file angle.m in the directory @cvx:

function y = angle( x )

y = cvx( x.size_, angle( x.basis_ ) );


Now, say I want to optimize over vectors such that all angles are constrained to be equal. Given a fixed vector v, I do the following:

cvx_begin quiet

variable z(n) complex
variable q

angle(z) == q*ones(n,1)

maximize real(z'*v)


However, the optimal solution has the imaginary parts equal, and not angles. For instance, here is an example optimal z:

z =

   0.1718 - 0.0863i
   0.5861 - 0.0863i
  -0.7219 - 0.0863i
   0.2756 - 0.0863i

Is there something I’m not understanding here?

I don’t understand what you’ve done, But why do you believe that complex angle (equality constraint) is convex? I don’t.