getLinearIndependentCell(A,ignore_constant_shift)
[Abasis, Abasisi, Asubs] = getLinearIndependentCell(A,ignore_constant_shift)
Purpose: Takes in a matrix or cell array and identifies a
subset of independent columns. It also clusters subsets of columns
that are dependent upon each other.
Details: If input is a matrix, behavior is exacly the same as
getLinearIndependent. That is, for numeric inputs, "dependence" is
determined based on linear dependence (e.g. If col2 = 2*col1, then col1 and
col2 would be considered dependent. For non-numeric inputs, columns are
automatically considered independent unless they are equivalent (see
examples).
Usage:
[Abasis, Abasisi, Asubs] = getLinearIndependentCell(A)
[Abasis, Abasisi, Asubs] = getLinearIndependentCell(A,ignore_constant_shift)
Inputs:
A: Input matrix or cell array. If a matrix is supplied, behavor is the
same as getLinearIndependent.
Inputs (Optional):
ignore_constant_shift: Flag (true / false [default]) for ignoring a constant term
in determining independence (e.g. if col2 = 10-col1, col1 and col2 will
be grouped together if true; otherwise separately if false).
Outputs:
Abasis: The set of linearly independent basis vectors in A
Abasisi: Index locations of original basis vectors in A, such
that Abasis = A(:,Abasisi).
Asub: Cell array with one element for each basis vector in A. Each cell
in Asub identifies clusters of columns in the original matrix A that
share linear dependence.
% Example:
A = {'a','b','c';'a','b','c';'d','e','f';1,2,3;1,2,5;5,3,@plot;5,3,@plot;2,4,6}';
% A =
% 'a' 'a' 'd' [1] [1] [ 5] [ 5] [2]
% 'b' 'b' 'e' [2] [2] [ 3] [ 3] [4]
% 'c' 'c' 'f' [3] [5] @plot @plot [6]
[Abasis, Abasisi, Asubs] = getLinearIndependentCell(A)
% Results:
%
% % % % % % % % % Abasis - the subset of basis columns % % % % % % % % %
%
% horzcat(Abasis{:})
% 3x5 cell array
% [1] [1] 'a' 'd' [ 5]
% [2] [2] 'b' 'e' [ 3]
% [3] [5] 'c' 'f' @plot
%
% % % % Abasisi - the indices of these columns in the original matrix % % %
%
% Abasisi =
% 1x5 cell array
% [4] [5] [1] [3] [6]
%
% % % % % % % % % Asubs - subsets ofl linearly dependent columns % % % % % % % % %
%
% Asubs =
% 1x5 cell array
% [1x2 double] [5] [1x2 double] [3] [1x2 double]
% Asubs{1} : [4, 8]
% Asubs{2} : [5]
% Asubs{3} : [1, 2]
% Asubs{4} : [3]
% Asubs{5} : [6, 7]
Submodules: getLinearIndependent, uniqueCellGeneralized, iscellnum
Author: David Stanley, Boston University, 2017
See also: getLinearIndependent, rref, unique
引用格式
Dave Stanley (2024). getLinearIndependentCell(A,ignore_constant_shift) (https://www.mathworks.com/matlabcentral/fileexchange/64222-getlinearindependentcell-a-ignore_constant_shift), MATLAB Central File Exchange. 检索时间: .
MATLAB 版本兼容性
平台兼容性
Windows macOS Linux类别
标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!