Error: Illegal operation: sqrt( {convex} )


for k = 1:length(Target)
    cvx_begin quiet % The keyword quiet silences CVX output to screen
        variable x(4) 
        subject to
            mu*x ==0.06;
            ones(1,4)*x == 1;
            x >= 0;
    X = [X x];

Disciplined convex programming error:
Illegal operation: sqrt( {convex} ).

I don’t know how to solve this problem.

Presuming Sigma is positive definite (I presume it is a covariance matrix), sqrt(x'*Sigma*x) can be rewritten as norm(chol(Sigma)*x). Or if Sigma is only positive semidefinite, as norm(sqrtm(Sigma)*x).

But the objective function doesn’t look concave. So I think you will need to change the mathematical formulation if you want to use CVX. Perhaps you can get some ideas from MOSEK Portfolio Optimization Cookbook.

One observation is that mu*x is fixed, due to the constraint. So, presuming r_0 <= 0.06, your objective function is equivalent to minimize (sqrt(x'*Sigma*x)), which I showed you above how to formulate for CVX. is this the model you really want?