Find random samples of some rows in the matrix and ensure the rank

1 次查看(过去 30 天)
I have a matrix 'A':
A = [ 1.2285 -1.2285 2.3433e-17 -4.1658e-17
0.70827 -0.70827 1.351e-17 -2.4017e-17
-1.2285 1.2285 -4.1658e-17 5.9885e-17
-1.8226e-17 4.1658e-17 1.0932 -1.1271
-2.4017e-17 2.4017e-17 0.63025 -0.64979
-4.1658e-17 4.1658e-17 -1.161 1.1948
0 0 1.1159 0
0 0 0 1.0901];
I want to find the random sample of some rows 'index' in matrix 'A' so that each sample A(index,:) ensure rank.

采纳的回答

Matt J
Matt J 2021-5-1
编辑:Matt J 2021-5-1
What does it mean to "ensure the rank"? Do you mean you want to find a random full-rank subset of rows? If so,
A = [ 1.2285 -1.2285 2.3433e-17 -4.1658e-17
0.70827 -0.70827 1.351e-17 -2.4017e-17
-1.2285 1.2285 -4.1658e-17 5.9885e-17
-1.8226e-17 4.1658e-17 1.0932 -1.1271
-2.4017e-17 2.4017e-17 0.63025 -0.64979
-4.1658e-17 4.1658e-17 -1.161 1.1948
0 0 1.1159 0
0 0 0 1.0901];
M=size(A,1);
N=rank(A);
B=[];
while rank(B)<N
index=randperm(M,N);
B=A(index,:);
end
index=sort(index),
index = 1×3
3 5 8
B=A(index,:)
B = 3×4
-1.2285 1.2285 -0.0000 0.0000 -0.0000 0.0000 0.6302 -0.6498 0 0 0 1.0901
  1 个评论
NA
NA 2021-5-1
编辑:NA 2021-5-2
Do you mean you want to find a random full-rank subset of rows?
I mean, a heuristic search to avoid non-observable set.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by