This is my MWW, i would like to find parameters x and y leading the expression (A+X)*v1+(B+Y)*v2 to zero.
How to do that with optimize?
% Minimal Work Example
A=[7 -2 3 2 -3;
2 -1 0 1 0;
-2 5 11 -5 -6;
3 2 -2 1 0;
5 7 8 -9 1;
2 9 0 1 -5];
v1=[1;-1;2;1;4];
B=[3 1 3;
-2 5 4;
0 7 -1;
2 9 0;
-2 5 11;
7 2 3];
v2=[2;1;-1];
x=sdpvar(2,1);
y=sdpvar(2,1);
X=[0 0 x(2) 0 0;
-x(1) 0 0 0 0;
0 -x(1) 0 0 0;
x(2) 0 x(1) 0 0;
x(1) -x(2) 0 0 0;
-x(1) 0 0 0 0];
Y=[y(1) y(2) 0;
0 0 -y(1);
0 y(2) 0;
y(1) 0 -y(2);
-y(1) y(1) 0;
0 -y(1) 0];
xL=[-10;-10];
xU=[10;10];
yL=[-10;-10];
yU=[10;10];
ConstrX=[xL<=x<=xU];
ConstrY=[yL<=y<=yU];
p=(A+X)*v1+(B+Y)*v2;
oldval=A*v1+B*v2;
I think about using:
sol=optimize(ConstrX+ConstrY,p);
Is this correct?