Which columns are linearly independent in a matrix?

10 visualizzazioni (ultimi 30 giorni)
juan
juan il 10 Set 2011
Modificato: Dave Stanley il 24 Ago 2017
Hi everybody:
I need to know what columns of a matrix are linearly independent.
Someone says that the "rref" command can do this, but I cannot get it, because I know that this command only give me a reduced form of an Echelon matrix.
What I need is the index of the columns of a matrix that are linearly independent. Can someone give me a help?
Thanks in advance.

Risposte (2)

Andrei Bobrov
Andrei Bobrov il 10 Set 2011
[i1 j1] = find(triu(squeeze(all(abs(diff(bsxfun(@rdivide,A,permute(A,[1 3 2]))))<1000*eps)),1));
indclm = find(~ismember(1:size(A,1),unique([i1; j1])));
variant 2
ic = nchoosek(1:size(A,2),2)
indclm = find(~ismember(1:size(A,1),unique(ic(all(abs(diff(A(:,ic(:,1))./A(:,ic(:,2)))) < 100*eps),:))))

Dave Stanley
Dave Stanley il 24 Ago 2017
Modificato: Dave Stanley il 24 Ago 2017
I wrote a few functions to handle this. They do basically the same as Andrei's solution above, with some added bells and whistles. (Namely, it includes an option for ignoring columns that are shifted by a constant; for example, if col2 = 10 - col1 ). Hope it's useful.

Community Treasure Hunt

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

Start Hunting!

Translated by