Generating a random matrix with range
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Melwin Thomas
le 5 Juin 2018
Commenté : Melwin Thomas
le 5 Juin 2018
Hi,
I am trying to generate 12*2 matrix. The first column should contain random values between [0 5] and the second column should have random values between [5 20]. Can you help me out with this.
0 commentaires
Réponse acceptée
Kodavati Mahendra
le 5 Juin 2018
May be something crude like this?
x = rand(12,2);
x(:,1) = 5*x(:,1);
x(:,2) = 5+15*x(:,2)
rand generates uniformly distributed random number in the interval (0,1).
3 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Random Number Generation 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!