Solving an overdetermined linear system

8 ビュー (過去 30 日間)
Mustafa Duran
Mustafa Duran 2023 年 8 月 8 日
編集済み: Bruno Luong 2023 年 8 月 8 日
My code is like that and MATLAB gives me error of inconsistancy, how can i solve overdetermined linear system?
syms e0 e1 e2
T1=1;
T2=3;
T3=4;
T4=5;
T5=6;
TM1=8;
TM2=7;
TM3=6;
TM4=5;
TM5=4;
Eqns = [e0 + T1*TM1*e1 - T1*e2 == TM1
e0 + T2*TM2*e1 - T2*e2 == TM2
e0 + T3*TM3*e1 - T3*e2 == TM3
e0 + T4*TM4*e1 - T4*e2 == TM4
e0 + T5*TM5*e1 - T5*e2 == TM5];
[A,b] = equationsToMatrix(Eqns, [e0, e1, e2]);
x=linsolve(A,b);
x
OUTPUT:
Warning: Solution does not exist because the system is inconsistent.
x =
Inf
Inf
Inf

採用された回答

Bruno Luong
Bruno Luong 2023 年 8 月 8 日
編集済み: Bruno Luong 2023 年 8 月 8 日
least square solution
syms e0 e1 e2
T1=1;
T2=3;
T3=4;
T4=5;
T5=6;
TM1=8;
TM2=7;
TM3=6;
TM4=5;
TM5=4;
Eqns = [e0 + T1*TM1*e1 - T1*e2 == TM1
e0 + T2*TM2*e1 - T2*e2 == TM2
e0 + T3*TM3*e1 - T3*e2 == TM3
e0 + T4*TM4*e1 - T4*e2 == TM4
e0 + T5*TM5*e1 - T5*e2 == TM5];
[A,b] = equationsToMatrix(Eqns, [e0, e1, e2]);
x = (A'*A)\(A'*b)
x = 

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSystems of Nonlinear Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by