How to express x(1)^2+x(2)^2=y^2?


(Guanfu Liu) #1

How to express x(1)^2+x(2)^2=y^2 as a constraint in cvx? Thanks very much.
My code is as follows.

%%%%%%%%%%%%%%%%%%%%

U=[ 2.0647, 0 , -1.8435; 0 , 0.9080 , 0;-1.8435, 0, 1.6475]

w=mvnrnd([0;0;0],inv(Q),1)’;
b=-2Qw;
p=B0’*b;

cvx_begin quiet
variables x(2) y;
minimize(quad_form([x’,y]’,U)+[x’,y]p);
subject to
norm(x)==norm(y);
B1
[x’,y]’<=[0;0];
cvx_end
cvx_x=B0*[x’,y]’;


(Erling D.Andersen) #2

That is nonconvex so you cannot do that with CVX… You can do norm(x) <= norm(y).


(Michael C. Grant) #3