Give parametric solution of system of linear equations

20 views (last 30 days)
If we have a system of linear equations like this:
S2 - S1 + S3 == 0
- S1 - S2 - S3 == 0
S1 - S2 - S3 == 0
How can we make MatLab give the solution?
As you can calculate for yourself, the solution will be parametric. In this case the solution will be:
t*[0; 1; -1] where t is a parameter.
When I try to use linsolve in MatLab, it says "Warning: System is rank deficient. Solution is not unique."
So how can we write to make matlab give the parametric solution? I.e. I want MatLab to write something similar to this:
t*[0; 1; -1]
How can we do that?

Answers (1)

Matt J
Matt J on 28 Mar 2015
Edited: Matt J on 28 Mar 2015
I think you've mis-typed your example. The system of equations you've shown is nonsingular and therefore can only have a solution of [0;0;0].
>> A=[1,-1, 1; -1,-1,-1; 1, -1, -1]
A =
1 -1 1
-1 -1 -1
1 -1 -1
>> cond(A)
ans =
2.0000
Also, only 2 equations are needed to define a line such as you've shown.
However, For non-singular A, representing the homogeneous equations, you can get the parametric solutions numerically using null(A). It might be possible to do the same for symbolic equations as well.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!