Solving an overdetermined linear system
8 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
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)
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Systems of Nonlinear Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!