You can use rref
to determine which columns in your matrix form the column space, and hence which vectors determine the rank of your matrix. Given your matrix that you're examining A
, you would call rref
like so:
[R,RB] = rref(A);
R
would be your matrix decomposed into row-reduced echelon form while RB
denotes the column indices that form the basis of your matrix A
. Therefore, to seek what you're asking, you would simply do:
Areduced = A(:,RB);
Areduced
will be the matrix that only consists of those basis vectors that form the column space of A
and hence reduce your matrix A
so that it only consists of those columns that allowed your matrix to be full rank.
However, judging from your question, you want to operate along the rows instead of the columns. Therefore, you can transpose your matrix first, use rref
on the result, then transpose back when you're finished:
Atranspose = A.';
[R,RB] = rref(Atranspose);
Areduced = Atranspose(:,RB).';