incorrect result in solving system using MATLAB ?

I am trynig to solve the following system (mat=coefficient matrix,B=output matrix)
mat =
1 2 6
2 5 14
5 7 24
B=
0
0
0
the expected result is not zeros for sure because this system is linear dependent . And I used mat/B and linsolve(mat,B).However , I have got the answer
ans=
0
0
0
and this warning
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND =
1.009294e-18.
could any one help me why I got this result and what I should to get the correct answer?

 Risposta accettata

Try
Z = null(mat)
It should give you a vector Z different from the zero vector that solves
mat*Z = 0
Best wishes
Torsten.

8 Commenti

I have got this answer
1.0e-14 *
0.0444
0
0.1776
The complete question of this is system: We have nontrivial solution of [b1 b2 b3]=[-12 -12 6].This implies the three given vectors are linearly dependent .Can you find another nontrivial solution ?
1.0e-14 *
0.0444
0
0.1776
is what you get when you run
mat = [1 2 6 ; 2 5 14 ; 5 7 24]
Z = null(mat);
Z
?
Then your MATLAB version has a bug.
Result should be
[-2/3 -2/3 1/3] or [2/3 2/3 -1/3]
Best wishes
Torsten.
No this result of this operation mat*Z to check if it gives the 0 or not
And what do you get for Z ?
Because this is one of the vectors you've been searching for, I thought ?
Best wishes
Torsten.
Any non-zero scalar multiple of [-12; -12; 6] is also a solution. [-12;-12;6] is 18 * null(mat)
I have got Z=-0.6667 -0.6667 0.3333 . However,I was having some problem in understanding null space. I was expect the result as I did it manually .So thanks all.
Was the result of null(mat, 'r') closer to what you found when you did it manually? From the help for the null function:
"The orthonormal basis is preferable numerically, while the rational basis may be preferable pedagogically."
The rational basis is what you get when you add the 'r' flag.

Accedi per commentare.

Più risposte (2)

Steven Lord
Steven Lord il 14 Nov 2017
That answer is one solution to your system of equations. It is not the only solution to that system.
If you add x and any linear combination of columns from the nullspace of your matrix that will be another solution to your system. Take a look at the null function for more information.
Walter Roberson
Walter Roberson il 14 Nov 2017
Modificato: Walter Roberson il 14 Nov 2017
rank(mat) is 2 because the third column is twice the sum of the other two columns. You cannot use the \ operator with singular matrix.
If the b matrix was not all zero then pinv(mat)*b might work, but since it is all 0 the result is going to be all 0.
With the all-zero b, you are effectively looking null spaces, for which you should look at null(mat)

2 Commenti

My goal of solving this system is to prove that it is not linear independent ,so I make it equal to b matrix which is equal to zero and if I get result rather than zeros this means it is Linear dependent ,but the result gave me zeros .All what I want now is getting any result except zeros .
11 * [1 2 6] - 3 * [2 5 14] = [5 7 24] . Therefore the last row does not add any new information to the matrix and the rank is 2.
"and if I get result rather than zeros this means it is Linear dependent"
No, it would mean that they were linearly independent

Accedi per commentare.

Categorie

Scopri di più su Linear Algebra in Centro assistenza e File Exchange

Richiesto:

il 14 Nov 2017

Commentato:

il 16 Nov 2017

Community Treasure Hunt

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

Start Hunting!

Translated by