ISCOPLANAR - Test for coplanar controls. [c,cols] = iscoplanar(B) Given a control effectiveness matrix B (k x m), the function returns c = 1 if there are k columns in B that are linearly dependent. The columns indexes of all such combinations are gathered in cols. Example: B = [1 1 0;0 0 1] [c,cols] = iscoplanar(B)
0001 function [c,cols] = iscoplanar(B) 0002 0003 % ISCOPLANAR - Test for coplanar controls. 0004 % 0005 % [c,cols] = iscoplanar(B) 0006 % 0007 % Given a control effectiveness matrix B (k x m), the function returns 0008 % c = 1 if there are k columns in B that are linearly dependent. 0009 % The columns indexes of all such combinations are gathered in cols. 0010 % 0011 % Example: 0012 % 0013 % B = [1 1 0;0 0 1] 0014 % [c,cols] = iscoplanar(B) 0015 0016 % Dimensions 0017 [k,m] = size(B); 0018 0019 % Construct all n combinations of k columns. 0020 C = nchoosek(1:m,k); 0021 n = nchoosek(m,k); 0022 0023 c = 0; 0024 cols = []; 0025 % Check all k x k submatrices of B. 0026 for i = 1:n 0027 Bsub = B(:,C(i,:)); 0028 if qrank(Bsub) < k 0029 % Coplanar controls detected 0030 c = 1; 0031 cols = [cols ; C(i,:)]; 0032 end 0033 end