Normalizing Vector

Is there a way to normalize a vector to unit length?

For example vec = vec./norm(vec)

It keeps saying that the operation/result is non-convex.

Thank you.

If vec is a CVX variable or expression (which must be affine, else norm(vec) wouldn’t be allowed), you can not divide it by norm(vec).

However, there are some situations in which that denominator can be multiplied out. For instance, if x were a scalar CVX variable, then instead of x/norm(x) >= 1, you could enter x >= norm(x). I don’t know whether there are non-trivial cases in which this would be useful for a non-scalar CVX variable.

Great insights, I am wondering, if vec is a vector instead of a scalar, is there any solution to solve maximize vec/norm(vec) using CVX

I don’t even know what vec/norm(vec) is. It doesn’t even appear to be a scalar, let alone convex. But whatever it is, I don’t believe you can maximize it in CVX.