MATLAB: System of Equations: linsolve warning re: rank-deficient system, but null function & A\B aren’t helping to fix the problem.

linsolveMATLABnullsolvesystem of equations

I have a system of equations with 9 equations & 9 unknowns. When I try to use either the linsolve or solve functions, I get a warning that says "solution is not unique b/c the system is rank-deficient". I have tried using the 'null' function to get around this, but it isn't helping (I'm not sure I'm doing it correctly, either). I have also tried using A\B without success.
The warning I receive is:
Warning: Solution is not unique because the system is rank-deficient.
> In symengine
In sym/privBinaryOp (line 991)
In sym/linsolve (line 63)
In Roberta_epNdIsoPlot (line 154)
I have listed my code below, and the result I get looks like this:
X =
87210399887576469606093503332352/4079960882434046875
0
0
0
0
0
0
0
0
If somebody could please help me figure out where I'm going wrong or how to get the null function to work properly I would be forever grateful. Thank you so much.
syms p1 p2 p3 p4 p5 p6 p7 p8 p9 % assigns these as symbols so they can be used as variables in the system of equations
eqn1 = p1 == (Lit_IsoSr(1) - ((pOpx .* p2) + (pCpx .* p3) + (pBt .* p4)...
+ (pPl .* p5) + (pKfs .* p6) + (pQtz .* p7) + (pMt .* p8) + (pIl .* p9))) ./ pFl;
eqn2 = p2 == ((Lit_IsoSr(1) - ((pFl .* p1) + (pCpx .* p3) + (pBt .* p4)...
+ (pPl .* p5) + (pKfs .* p6) + (pQtz .* p7) + (pMt .* p8) + (pIl .* p9))) ./ pOpx);
eqn3 = p3 == ((Lit_IsoSr(1) - ((pFl .* p1) + (pOpx .* p2) + (pBt .* p4)...
+ (pPl .* p5) + (pKfs .* p6) + (pQtz .* p7) + (pMt .* p8) + (pIl .* p9))) ./ pCpx);
eqn4 = p4 == ((Lit_IsoSr(1) - ((pFl .* p1) + (pOpx .* p2) + (pCpx .* p3)...
+ (pPl .* p5) + (pKfs .* p6) + (pQtz .* p7) + (pMt .* p8) + (pIl .* p9))) ./ pBt);
eqn5 = p5 == ((Lit_IsoSr(1) - ((pFl .* p1) + (pOpx .* p2) + (pCpx .* p3)...
+ (pBt .* p4) + (pKfs .* p6) + (pQtz .* p7) + (pMt .* p8) + (pIl .* p9))) ./ pPl);
eqn6 = p6 == ((Lit_IsoSr(1) - ((pFl .* p1) + (pOpx .* p2) + (pCpx .* p3)...
+ (pBt .* p4) + (pPl .* p5) + (pQtz .* p7) + (pMt .* p8) + (pIl .* p9))) ./ pKfs);
eqn7 = p7 == ((Lit_IsoSr(1) - ((pFl .* p1) + (pOpx .* p2) + (pCpx .* p3)...
+ (pBt .* p4) + (pPl .* p5) + (pKfs .* p6) + (pMt .* p8) + (pIl .* p9))) ./ pQtz);
eqn8 = p8 == ((Lit_IsoSr(1) - ((pFl .* p1) + (pOpx .* p2) + (pCpx .* p3)...
+ (pBt .* p4) + (pPl .* p5) + (pKfs .* p6) + (pQtz .* p7) + (pIl .* p9))) ./ pMt);
eqn9 = p9 == ((Lit_IsoSr(1) - ((pFl .* p1) + (pOpx .* p2) + (pCpx .* p3)...
+ (pBt .* p4) + (pPl .* p5) + (pKfs .* p6) + (pQtz .* p7) + (pMt .* p8))) ./ pIl);
% below code uses the 'equationsToMatrix' function to convert sys of eqns
% into a solveable matrix of form AX = B
[A, B] = equationsToMatrix([eqn1, eqn2, eqn3, eqn4, eqn5, eqn6, eqn7, eqn8, eqn9],...
[p1, p2, p3, p4, p5, p6, p7, p8, p9]);
X = linsolve(A, B)

Best Answer

I'm more awake now to look at your equations, although I see that use of null is still essentially meaningless here. They are all of the general form:
p1 == (Lit_IsoSr(1) - ((pOpx .* p2) + (pCpx .* p3) + (pBt .* p4)...
+ (pPl .* p5) + (pKfs .* p6) + (pQtz .* p7) + (pMt .* p8) + (pIl .* p9))) ./ pFl;
where p1, p2, p3, p4,... p9 are the unknowns. So you have a 9x9 matrix of coefficients. I wonder at first if you have values for the coefficients or not, but that is not relevant as I look at your equations.
But then, as I look more closely at your equations. Strange, that. They are all identical! You only have one equation. That is, multiply equation 1 by pFl, then re-write it, by bringing all of the terms with p1,...p9 onto the left hand side.
pFl*p1 + pOpx.*p2 + pCpx.*p3 + pBt.*p4 + pPl.*p5 + pKfs.*p6 + pQtz .* p7 + pMt.*p8 + pIl.*p9 == Lit_IsoSr(1)
Now, do the same for equation 2, multiplying by pOpx. Indeed, I get identically the same equation, with the same constant on the right hand side. If we repeat this operation on each of your equations, I get the same identical result.
VERY STRANGE.
You do NOT have a system of 9 equations in 9 unknowns. You have ONE equation, repeated 9 times. You just divided that equation by one of the constants, then decided to move some of the terms to the other side of the equality. You cannot create nine independent equations by taking your single equation, and then divide it by some value. equations 2-9 do not add any new information to the problem, beyond what you already had in equation 1.
The linear system is rank deficient because you only have ONE equation. You can completely arbitrarily pick any values you want for the unknowns p1,...p8, and then solve for p9. Or you can solve for any one of the unknowns, IF you only knew the others.
So again, this is not a probem that null can handle in any way. But worse, this is not a problem you can resolve in any meaningful way, but to write a set of 9 INDEPENDENT equations. So you do indeed need to reformulate your problem.