Vector optimization in CVX Matlab

There a re a lot of problems with your code. Here are some, but not necessarily all, of them.

The objective function must evlauate to real scalar. Yours is not when n >= 2. you need to formulate a scalar objective,

You are multiplying CVX (optimiation, a.k.a. decision) variables like it’s going out of style. That is not allowed in CVX Please read Why isn't CVX accepting my model? READ THIS FIRST! and http://cvxr.com/cvx/doc/ .

I can’t tell you how to fix your program because I have no idea what you are trying to do. I have no idea when all is said and done whether you will have a convex optimization problem.