Unless your are in a special situation, there is an infinity of suitable A's .. and there is a dimension mismatch in your statement. Assuming that X is really nx2 and Y is really 2x1, you must have Y = X.'*A, with A a nx1 vector in fact. You must hence solve:
y1 = x11 a1 + x12 a2 + .. + x1n an
y2 = x21 a1 + x22 a2 + .. + x2n an
which is a system of 2 equations with n unknowns ( ai). Unless you are in a special situation, you can therefore define n-2 ai and solve for the two remaining ones. This would provide one particular A that fits the system above. An "interesting" choice for the n-2 ai is to set ai=0 for i>2. This reduces the system above to:
y1 = x11 a1 + x12 a2
y2 = x21 a1 + x22 a2
or simply Y = Xred.'*Ared, with Xred=X(1:2,:) and Ared is what you are looking for. This is a linear system that you can easily solve.
Play a bit with the following to see what happens..
X = [1 2 3; 5 3 4].' ;
Y = [7 -3].' ;
n = size(X, 1) ;
X1 = X(1:2,:) ;
A1 = X1.' \ Y ;
A2 = zeros(n-2, 1) ;
A =[A1; A2]
Y-X.'*A
I let you think more in depth for special cases.
Cheers,
Cedric
Best Answer