How to solve A*X = B*Y

10 views (last 30 days)
Paul
Paul on 12 Dec 2012
Hello,
I would like to solve the following equation : A*X = B*Y where A and B are n-by-n known matrices. X and Y are vectors of size n. The first k elements of X and the last n-k elements of Y are known. Does anyone have a clue ?
Thank you very much for your help!
1 Comment
Paul
Paul on 12 Dec 2012
One way to resolve this problem is to solve the first k equations of the system X = A\B*Y : it a system with k equations and k unknowns but I don't know how to solve it with Matlab.

Sign in to comment.

Accepted Answer

Matt J
Matt J on 12 Dec 2012
Edited:Matt J on 12 Dec 2012
If you partition X into known and unknown parts
X=[x1 ; x2]
and similarly
Y=[y1;y2]
then the equation can be rewritten
A(:,k+1:end)*x2 - B(:,1:n-k-1)*y1= B(:,n+1-k:n)*y2 - A(:,1:k)*x1
The RHS of the above consists of all known quantities and reduces to some known vector b. The LHS can be combined into a single linear system which you can solve using normal methods.
1 Comment
Paul
Paul on 12 Dec 2012
Thanks a lot Matt !

Sign in to comment.

More Answers (1)

Jan
Jan on 12 Dec 2012
Edited:Jan on 12 Dec 2012
== This is not valid Matlab syntax ==
The first k elements of X are known and the last n-k of Y:
X = [q; x] = [q; 0] + [0; x]% Here "0" means a zero vector
Y = [y; p] = [y; 0] + [0; p]
Now you get:
A*X = A*[q; 0] + A*[0; x] = B*[y; 0] + B*[0; p]
A*[0; x] - B*[y; 0] = B*[0; p] - A*[q; 0] = C
((:, 1: k),B(:, k+1:n)] * [y; x] = D * [y; x] = D*z = C
z = D\C;
X_unknown = z(k+1:n);
Y_unknown = z(1:k);
1 Comment
Paul
Paul on 12 Dec 2012
Thanks a lot Jan !

Sign in to comment.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!