Return submatrix that has Full Rank

3 ビュー (過去 30 日間)
Shubham Nipanikar
Shubham Nipanikar 2020 年 4 月 23 日
編集済み: David Goodmanson 2020 年 4 月 23 日
So I have P = ctrb(A,C) which returns the controllability matrix. which is say 5x10 Now if it has full rank, I want MATLAB to just return the 5x5 matrix that fulfills the rank requirement. How can I do this? Because I need to use that P matrix in further calculations but I can't do it with the 5x10 matrix that MATLAB gives me, I need the 5x5
  1 件のコメント
KSSV
KSSV 2020 年 4 月 23 日
Keep taking five columns randomly and check the rank.

サインインしてコメントする。

回答 (1 件)

David Goodmanson
David Goodmanson 2020 年 4 月 23 日
編集済み: David Goodmanson 2020 年 4 月 23 日
Hello Shubham,
% make up an example
nrow = 5;
ncol = 10; % ncol > nrow
A = rand(nrow,ncol);
A = [A(:,1),A(:,2),A]; % toss in some duplicate columns to make sure they get rejected
At = A'; % work with transpose
[m n] = size(At); % m > n
[~, ~, p] = lu(At);
Atsub = p*At;
Asub = Atsub(1:n,:)'; % take top rows, transpose back
ind = p*(1:m)';
ind = ind(1:n)'; % index shows which columns were selected
format compact
Asub
A % visual check that all columns of Asub are contained in A
ind
rank(Asub)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by