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

1 vue (au cours des 30 derniers jours)
NA
NA le 30 Avr 2021
Modifié(e) : NA le 2 Mai 2021
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.

Réponse acceptée

Matt J
Matt J le 1 Mai 2021
Modifié(e) : Matt J le 1 Mai 2021
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 commentaire
NA
NA le 1 Mai 2021
Modifié(e) : NA le 2 Mai 2021
Do you mean you want to find a random full-rank subset of rows?
I mean, a heuristic search to avoid non-observable set.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by