Find a real number
9 ビュー (過去 30 日間)
古いコメントを表示
Hi, I'm new to Matlab and I'm trying to find a real number in the range from 10 to 20? I know how to use rand but only from 0. I also have to find an integer in the range from 1 to 10?
0 件のコメント
採用された回答
その他の回答 (1 件)
Image Analyst
2014 年 9 月 23 日
Did you look at the help for rand()? Here is the first example:
Example 1
Generate values from the uniform distribution on the interval [a, b]:
r = a + (b-a).*rand(100,1);
For you a=10 and b=20 so the formula is:
r = 10 + 10 * rand(1);
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!