Azzera filtri
Azzera filtri

how to check whether a vector in a subspace or not?

23 visualizzazioni (ultimi 30 giorni)
I want to know how to check a vector in b can be expressed by the basis of a subspace. Or whether the vector in b in the subspace or not?
V=[2 3 1 -3 11 2 5;3 3 2 -3 10 3 9;4 3 0 2 -3 9 4;2 -1 -1 1 -3 2 -1;3 -1 3 0 -4 2 12;1 0 4 3 -13 4 13]
ra=rank(V)
R = rref(V)
b1=[4;4;7;2;-1;0]
b2=[1;2;5;6;8;9;]
b=[b1 b2]
Your help would be highly appreciated!

Risposta accettata

John D'Errico
John D'Errico il 22 Ott 2022
Modificato: John D'Errico il 22 Ott 2022
You want to test if a new vector (not two at a time!) lies in the column space of a matrix V. Here, V is a 6x7 matrix.
V=[2 3 1 -3 11 2 5;3 3 2 -3 10 3 9;4 3 0 2 -3 9 4;2 -1 -1 1 -3 2 -1;3 -1 3 0 -4 2 12;1 0 4 3 -13 4 13]
V = 6×7
2 3 1 -3 11 2 5 3 3 2 -3 10 3 9 4 3 0 2 -3 9 4 2 -1 -1 1 -3 2 -1 3 -1 3 0 -4 2 12 1 0 4 3 -13 4 13
ra=rank(V)
ra = 4
So even though V has more columns than rows,
size(V)
ans = 1×2
6 7
it only as rank 4. If V were full rank, then ANY new vector must lie in the column space of V. But V has rank only 4, so there is "room".
So append the new vector as a new column of V. IF the rank of the new matrix does not change, then the appended vector was already representable as a linear combination of the columns of V. If the rank changes, then your vector is linearly independent of the columns of V.
Again, you must do this test twice, so once for each vector you wish to test. (Don't keep on appending new vectors to V, so that V is growing in size with each test.)

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by