Which columns are linearly independent in a matrix?

2 次查看(过去 30 天)
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.

回答(2 个)

Andrei Bobrov
Andrei Bobrov 2011-9-10
[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 2017-8-24
编辑:Dave Stanley 2017-8-24
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.

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by