Overdetermined system of equations

My equation looks as follows: Y = x1*A + x2*B + x3*C, where Y, A, B, C are matrices of the 260x100 dimension and I want to solve for x1 , x2 , x3 but I'm not sure how to approach this in Matlab. Could someone share some tips with me, please ?

2 comentarios

John D'Errico
John D'Errico el 3 de Jul. de 2017
Are x1,x2,x3 scalar unknowns? Are they arrays?
Damian Wierzbicki
Damian Wierzbicki el 3 de Jul. de 2017
They're scalar unknowns

Iniciar sesión para comentar.

 Respuesta aceptada

John D'Errico
John D'Errico el 3 de Jul. de 2017
So you have only 3 unknowns.
x123 = [A(:),B(:),C(:)]\Y(:);
This returns a vector of length 3, which is the linear least squares solution.

4 comentarios

Damian Wierzbicki
Damian Wierzbicki el 3 de Jul. de 2017
Thank you :)
Damian Wierzbicki
Damian Wierzbicki el 4 de Jul. de 2017
What if I had another equation that looks as follows: Z = x1*D + x2*E + x3*F, where Z, D, E, F are again matrices of the same size as above and x1, x2, x3 are defined as above. When I solve them separately, they give me two different set of solutions, as expected. How can I combine the two equation, so I get one set of solutions for both systems ? Adding both sides of the equation and then solving for x1, x2, x3 ? I'd be really grateful if you could help.
x123=[A(:),B(:),C(:);D(:),E(:),F(:)]\[Y(:);Z(:)];
Best wishes
Torsten.
Damian Wierzbicki
Damian Wierzbicki el 4 de Jul. de 2017
Thank you !

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Community Treasure Hunt

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

Start Hunting!

Translated by