how to find specific variable values for solving equation system
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Torsten
2022-2-25
编辑:Torsten
2022-2-25
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 个评论
Torsten
2022-2-25
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]
另请参阅
类别
在 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!