how to find specific variable values for solving equation system

3 views (last 30 days)
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;

Answers (1)

Torsten
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
fima v
fima v on 25 Feb 2022
Hello i need d1 d2 d3 d4 d5 d6 to be 5
how do i formulate the matrices method you proposed?
so i get p1 p3 p6 p4 such values that will do d1..d6=5
x1=10;
p1=2.5;
p5=5;
p6=10;
p3=3.75;
p4=+2.5;
pr(1)=x1-p1-p5-p6;
pr(2)=x1+p1-p5-p6;
pr(3)=x1-p1+p5-p6;
pr(4)=x1+p1+p5-p6;
pr(5)=x1-p3+p6;
pr(6)=x1-p4+p3+p6;
pr(7)=x1+p4+p3+p6;
d1=pr(2)-pr(1)
d2=pr(3)-pr(2)
d3=pr(4)-pr(3)
d4=pr(5)-pr(4)
d5=pr(6)-pr(5)
d6=pr(7)-pr(6)
Torsten
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]

Sign in to comment.

Categories

Find more on Dynamic System Models 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!