how to find specific variable values for solving equation system
3 views (last 30 days)
Show older comments
Hello,i have the following equation system.
is there a way in matlab to find P1..P6 values so
pr(2)=pr(1)+5
pr(3)=pr(2)+5
etc..
x1=10;
pr(1)=x1-p1-p5-p6;
pr(2)=x1+p1-p5-p6;
pr(3)=x1-p2+p5-p6;
pr(4)=x1+p2+p5-p6;
pr(5)=x1-p3+p6;
pr(6)=x1-p4+p3+p6;
pr(7)=x1+p4+p3+p6;
0 Comments
Answers (1)
Torsten
on 25 Feb 2022
Edited: Torsten
on 25 Feb 2022
Yes.
You have 13 linear equations for 13 unknowns P = [pr(1),...,pr(7),p1,...,p6].
Write the system as
A*P = B
and solve for P as
P = A\B
In your case:
x1 = 10;
A = [1 0 0 0 0 0 0 1 0 0 0 1 1;...
0 1 0 0 0 0 0 -1 0 0 0 1 1;...
0 0 1 0 0 0 0 0 1 0 0 -1 1;...
0 0 0 1 0 0 0 0 -1 0 0 -1 1;...
0 0 0 0 1 0 0 0 0 1 0 0 -1;...
0 0 0 0 0 1 0 0 0 -1 1 0 -1;...
0 0 0 0 0 0 1 0 0 -1 -1 0 -1;...
-1 1 0 0 0 0 0 0 0 0 0 0 0;...
0 -1 1 0 0 0 0 0 0 0 0 0 0;...
0 0 -1 1 0 0 0 0 0 0 0 0 0;...
0 0 0 -1 1 0 0 0 0 0 0 0 0;...
0 0 0 0 -1 1 0 0 0 0 0 0 0;...
0 0 0 0 0 -1 1 0 0 0 0 0 0];
B = [x1 ; x1 ; x1 ; x1 ; x1 ; x1; x1 ; 5 ; 5 ; 5 ; 5 ; 5 ; 5];
P = A\B
2 Comments
Torsten
on 25 Feb 2022
I already defined the matrix equation above and determined the solution vector
P = [pr(1);pr(2);pr(3);pr(4);pr(5);pr(6);pr(7);p1;p2;p3;p4;p5;p6]
See Also
Categories
Find more on Systems of Nonlinear Equations 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!