how to random value?
古いコメントを表示
how to random value 2 until 3? example:
>> a=rand(1)
a =
0.8833
but i want the answer 2,3 or 2,5 or 2,6, or 3. thanks
回答 (2 件)
Azzi Abdelmalek
2013 年 4 月 3 日
編集済み: Azzi Abdelmalek
2013 年 4 月 3 日
n=3
a=rand*n %
Generate values from the uniform distribution on the interval [a, b].
r = 2 + (3-2).*rand(1);
or the general form
r=a+(b-a).*rand(n);
カテゴリ
ヘルプ センター および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!