Which columns are linearly independent in a matrix?
10 views (last 30 days)
Show older comments
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.
0 Comments
Answers (2)
Andrei Bobrov
on 10 Sep 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),:))))
0 Comments
Dave Stanley
on 24 Aug 2017
Edited: Dave Stanley
on 24 Aug 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.
0 Comments
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!