How can I produce a matrix with below condition?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi everyone.I need to produce a k×1 matrix that its first element always is 1 and the others return a random number in [0,1].This interval contains 0 and 1 and all values between them.
0 commentaires
Réponse acceptée
Voss
le 10 Nov 2023
Something like this may be good enough:
k = 8;
result = [1; rand(k-1,1)]
2 commentaires
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!