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

2 visualizaciones (últimos 30 días)
NA
NA el 30 de Abr. de 2021
Editada: NA el 2 de Mayo de 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.

Respuesta aceptada

Matt J
Matt J el 1 de Mayo de 2021
Editada: Matt J el 1 de Mayo de 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 comentario
NA
NA el 1 de Mayo de 2021
Editada: NA el 2 de Mayo de 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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by