Generate a random binary matrix with given rank by using minimum number of 1s
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Efe Berkay Yitim
le 16 Fév 2023
Réponse apportée : Efe Berkay Yitim
le 16 Fév 2023
Hi,
I am generating a random binary matrix with size ky x w with rank min(ky,w) with the code given below. However, because I am not constraining the possibility to select 0 or 1 as an element of a matrix, number of 0s and 1s are almost equal to each other. I need to create this matrix with rank min(ky,w) using minimum number of 1s. How can I achieve this, any suggestion?
k = 5;
y = 20;
w = 104;
A = randi([0 1], k*y, w);
while gfrank(A) ~= min(k*y, w)
A = randi([0 1], k*y, w);
end
0 commentaires
Réponse acceptée
Plus de réponses (0)
Voir également
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!