# I have a question use CVX to get the projection on a set

Hi, I have use the folling code, but the result is negative? why? I used CVX 2.0, matlab R2010b

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dd = [1 1 1 1 1 1 1 1 1 1 1];
cvx_begin
variable y(11)
minimize( norm(y - old_avg_pi , 2 ))
subject to
dd * y == 1
-y <= 0
cvx_end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

old_avg_pi =

1.0e+006 *

``````0.7696
1.3818
0.6645
5.8412
0.0000
0.4283
0.6691
3.9130
0.7088
1.4975
1.1092
``````

## Calling SDPT3 4.0: 23 variables, 12 equality constraints

num. of constraints = 12
dim. of socp var = 12, num. of socp blk = 1
dim. of linear var = 11

SDPT3: Infeasible path-following algorithms

## number of iterations = 10 primal objective value = 7.54857799e+006 dual objective value = 7.54857813e+006 gap := trace(XZ) = 2.46e-002 relative gap = 1.63e-009 actual relative gap = -8.70e-009 rel. primal infeas = 7.62e-009 rel. dual infeas = 1.33e-009 norm(X), norm(y), norm(Z) = 1.1e+007, 2.2e+000, 2.5e+000 norm(A), norm(b), normĀ© = 6.7e+000, 1.9e+007, 2.0e+000 Total CPU time (secs) = 0.13 CPU time per iteration = 0.01 termination code = 0 DIMACS: 8.3e-009 0.0e+000 1.3e-009 0.0e+000 -8.7e-009 1.6e-009

Status: Solved
Optimal value (cvx_optval): +7.54858e+006

y =

``````0.0011
``````

-0.0212
0.0046
1.1923
0.0016
0.0012
0.0094
-0.0084
-0.0285
0.0071
-0.0279