random number between -1 and 1
45 ビュー (過去 30 日間)
古いコメントを表示
Hi I need a 1 line code for a random number generator between 1 and -1 for one element.
0 件のコメント
採用された回答
Wayne King
2012 年 4 月 15 日
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 件のコメント
Jan
2012 年 4 月 15 日
@Mate 2u: If you read the help text of RAND you find corresponding examples. Please take the time to read the help and doc.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Random Number Generation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!