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.

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.