Pull 20 numbers randomly in the interval [0; 1]. What is the minimum value of the vector and the position of the Coefficient which realizes?

5 件のコメント

KL
KL 2017 年 10 月 24 日
It looks like a homework question. Did you try anything yet?
diadalina
diadalina 2017 年 10 月 24 日
yes, i know that rand can do this , but when we have 20 element, can anayone help me ?
diadalina
diadalina 2017 年 10 月 24 日
編集済み: per isakson 2017 年 10 月 24 日
i'm trying this, but it doesn't be the good result ?
r1=0:1/19:1,
x=rand(length(r1),1)
min(x), and
[~,i]=find(min(x))
per isakson
per isakson 2017 年 10 月 24 日
Read the documentation on min once more
[ m, ix ] = min( x );
diadalina
diadalina 2017 年 10 月 24 日
編集済み: diadalina 2017 年 10 月 24 日
yes, you're right, i can obtain the minimum value of the vector and the position of the Coefficient which realizes with the command min,but the first part of the question, how can i do it, can you help me please ?

サインインしてコメントする。

 採用された回答

KL
KL 2017 年 10 月 24 日

0 投票

Did you read the documentation of rand?
It says X = rand returns a single uniformly distributed random number in the interval (0,1)
So to generate 20 random numbers, you would use,
X = rand(20,1);
Then you can use min to find the value and index of the minimum value.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

質問済み:

2017 年 10 月 24 日

回答済み:

KL
2017 年 10 月 24 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by