random number between -1 and 1
58 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi I need a 1 line code for a random number generator between 1 and -1 for one element.
0 Kommentare
Akzeptierte Antwort
Wayne King
am 15 Apr. 2012
Do you want these uniform between -1 and 1?
r = -1 + 2.*rand(100,1);
For 1 such number
r = -1+2*rand(1,1);
1 Kommentar
Jan
am 15 Apr. 2012
@Mate 2u: If you read the help text of RAND you find corresponding examples. Please take the time to read the help and doc.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Random Number Generation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!