## Iteration of a matrix equality

### fert (view profile)

on 14 May 2017
Latest activity Edited by fert

### fert (view profile)

on 15 May 2017
Accepted Answer by John D'Errico

### John D'Errico (view profile)

I have been trying to solve an equation of the matrices with the iteration.
• A*PNode=del_node ; [Eq. 1]
• del_node=(L(i)/D(i)) ; [Eq. 2]
The sizes of the matrices are respectively; A [5x6], PNode [6x1], del_node [5x1], L [1X6] and D [1x6].
The first and the last elements of the PNode should be 2 and 6 respectively. How can I find the possible converged values for the D and PNode matrices assuming that A and L are given?

### Tags ### John D'Errico (view profile)

Answer by John D'Errico

### John D'Errico (view profile)

on 14 May 2017

You cannot do so. Too many unknowns.
PNode has 6 unknowns, but two are given, so only 4 true unknowns.
But you cannot solve for anything without the 6 unknown values of D. So up to 10 unknowns.
Oh, and del_node is completely unknown too. 5 more of them, so 15 unknowns in total.
The second set of equations, relating del_node to D, is of little help, since we can use that to essentially eliminate del_node.
One other point, the second set of equations is meaningless, since you tell us there are 5 elements of del_node. But the elements of del_node are simple ratios or L(i) and D(i). And since there are 6 values in L and D, that means you are trying to stuff 6 points of "stuff" into a 5 pound bag.
Regardless, you cannot solve the problem. No mathematics will give you an answer.
You need to spend some time re-thinking this problem.

Stephen Cobeldick

### Stephen Cobeldick (view profile)

on 15 May 2017
@fert: change the format.
John D'Errico

### John D'Errico (view profile)

on 15 May 2017
Notice the 1e+05* on top. Use the proper display format to be able to see all of the numbers.
format short g
is a good start. You really did get the same result as I did.
fert

### fert (view profile)

on 15 May 2017
Now the hard part, I am basically trying to get the values of the u(and hence D) and PNodes with the While Loop. I am using a contemporary matrix kkk which must be equal to the del_pipe with the residual of the diff. Though I am getting the error of dimensions disagreement.Can you also give a hand on this matter? Also assuming you are an Italian, grazie millie Dottore:)
A = transpose([1 0 0 0 0;0 1 0 0 0; 0 -1 1 0 0; -1 0 0 1 0; 0 0 -1 -1 -1; 0 0 0 0 1]);
f=0.002;g=9.81; rho=1000;del_t=9;cp=4.18;
L =[12 11 8 6 4];Q_node=[210 157 281 150 50];u=ones(1,5);D=ones(1,5);
PNode=zeros(6,1);PNode([1 5])=[2;6];
del_pipe=ones(5,1);kkk=ones(5,1);
diff=del_pipe-kkk;
jj=0;
%%converging the del_pipe and the kkk matrices in order to find the optimum D and PNode
while diff<1e-5
jj=jj+1;
for i=1:1:5
for j=1:1:6
D(i)=sqrt((Q_node(i)*4)/(3*u(i)*cp*rho*9));
del_node(i)=-1*(rho*f*L(i)/D(i))*u(i)^2/2;
del_pipe=transpose(del_node);
kkk(i)=(A(i,j)*PNode(j))+kkk(i);
diff=abs(del_pipe-kkk);
end
end
end