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

John D'Errico
John D'Errico 2017년 7월 3일
Are x1,x2,x3 scalar unknowns? Are they arrays?
Damian Wierzbicki
Damian Wierzbicki 2017년 7월 3일
They're scalar unknowns

댓글을 달려면 로그인하십시오.

 채택된 답변

John D'Errico
John D'Errico 2017년 7월 3일

0 개 추천

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

Damian Wierzbicki
Damian Wierzbicki 2017년 7월 3일
Thank you :)
Damian Wierzbicki
Damian Wierzbicki 2017년 7월 4일
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 2017년 7월 4일
Thank you !

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by