solve a linear system of equations with several unknown parameters
5 views (last 30 days)
Show older comments
hello ,
I have a system V*F=u with
V= [2 1 1; 4 1 1; 4 2 1; 2 2 1]
F=[f11, f21;f12, f22;g1, g2]
and u= [10,10;10,5 ;10,4; 40 ,40]
and i want to sove it in order to find f11,f12,f21,f22,g1 ang g2. I tried with this code but i get warning msg :Solution does not exist because the system is inconsistent.
I am not sure this is the right way to solve such a system
syms f11 f12 f21 f22 g1 g2
V=[2 1 1; 4 1 1; 4 2 1; 2 2 1] ;
F=[f11 f21;f12 f22;g1 g2];
U=[10,10;10,5 ;10,4; 40 ,40] ;
L=V*F;
eqn1 = L(1,1) == U(1,1);
eqn2 = L(1,2) == U(1,2);
eqn3 =L(2,1) == U(2,1);
eqn4 =L(2,2) == U(2,2);
eqn5 =L(3,1) == U(3,1);
eqn6 =L(3,2) == U(3,2);
eqn7 =L(4,1) == U(4,1);
eqn8 =L(4,2) == U(4,2);
[D,E] = equationsToMatrix([eqn1, eqn2, eqn3, eqn4, eqn5,eqn6,eqn7,eqn8], [f11, f12,f21,f22 g1,g2]);
Ug = linsolve(D,E);
thank you in advance.
0 Comments
Accepted Answer
Steven Lord
on 8 Nov 2022
syms f11 f12 f21 f22 g1 g2
V=[2 1 1; 4 1 1; 4 2 1; 2 2 1] ;
F=[f11 f21;f12 f22;g1 g2];
U=[10,10;10,5 ;10,4; 40 ,40] ;
L=V*F == U
Subtract the second equation in the first column from the third.
L(3, 1)-L(2, 1)
This tells us that f12 must be 0. Now subtract the fourth equation in the first column from the first.
L(4, 1)-L(1, 1)
This tells us that f12 must be 30. Is there a number that is simultaneously equal to 0 and equal to 30?
FM = V\U
check = V*FM-U
3 Comments
Torsten
on 9 Nov 2022
Edited: Torsten
on 9 Nov 2022
This is what Steven Lord tried to explain: your equations are contradictory and thus do not have a "solution" in the usual sense.
But as always, you can find FM that "best" solves your equations in the sense that norm(V*FM-U) is minimized. For a "solution" in the usual sense, norm(V*FM-U) would be 0.
More Answers (1)
Torsten
on 8 Nov 2022
Edited: Torsten
on 8 Nov 2022
You have 8 equations for 6 unknowns. The consequence in general is that there is no solution that satisfies the 8 equations exactly, but only in the least-squares sense. This is also the case here:
syms f11 f12 f21 f22 g1 g2
V=[2 1 1; 4 1 1; 4 2 1; 2 2 1] ;
F=[f11 f21;f12 f22;g1 g2];
U=[10,10;10,5 ;10,4; 40 ,40] ;
L=V*F;
eqn1 = L(1,1) == U(1,1);
eqn2 = L(1,2) == U(1,2);
eqn3 =L(2,1) == U(2,1);
eqn4 =L(2,2) == U(2,2);
eqn5 =L(3,1) == U(3,1);
eqn6 =L(3,2) == U(3,2);
eqn7 =L(4,1) == U(4,1);
eqn8 =L(4,2) == U(4,2);
[D,E] = equationsToMatrix([eqn1, eqn2, eqn3, eqn4, eqn5,eqn6,eqn7,eqn8], [f11, f12,f21,f22 g1,g2])
%Ug = linsolve(D,E);
Ug = double(D)\double(E)
double(D)*Ug-double(E)
0 Comments
See Also
Categories
Find more on Stability Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!