Convexity and DCP error

The error is due to the product of variables x_loose(:,i) and y_loose(:,i).

This looks non-convex to me. Basically, after reformulating the problem to eliminate z, this amounts to a non-convex QP

The 1st constraint would be a Rotated Second Order Cone constraint if rewritten in terms of a new variable z_sqrt, defined as the square root of z. But then the objective would be the sum over all dimensions of z_sqrt.^2, which is convex, and therefore can’t be maximized in CVX.

This could be turned into a convex optimization problem is you changed what is squared. That would not be an equivalent problem. You would have to determine whether or not that different problem would suit your needs.