# what is the result?

30 views (last 30 days)
diadalina on 24 Oct 2017
Answered: KL on 24 Oct 2017
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?

Show 2 older comments
diadalina on 24 Oct 2017
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 on 24 Oct 2017
Read the documentation on min once more
[ m, ix ] = min( x );
diadalina on 24 Oct 2017
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 on 24 Oct 2017
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.