Creating Random Sparse Matrices Using For Loop
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
lju2
el 15 de En. de 2021
Respondida: Walter Roberson
el 15 de En. de 2021
How would I go about creating a for loop to generate 100 different random sparse matrices? Each matrix would be 100x100 and have a density of 0.01. For example, I want to generate those matrices and then plot their bandwidth values.
0 comentarios
Respuesta aceptada
Walter Roberson
el 15 de En. de 2021
N = 100; S = 100;
RM = cell(N,1);
B = zeros(1,N);
for K = 1 : N
RM{K} = sprand(S, S, 0.01);
B(K) = bandwidth(RM{K});
end
histogram(B)
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Sparse Matrices 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!