Using Matlab 1 The command rand1 will generate a random numb
Using Matlab
1) The command rand(1) will generate a random number from the interval [0,1] from a uniformly distributed random generator. Use this command and a for-loop in a code which will generate 100 random numbers from [0,20] and calculate the mean of the generated numbers. (Is this what you expected?)
Solution
There is no need of for loop for doing so you can directly use below program where \'a\' is initial number \'b\' is final number.n is the count.
a = 0
b = 20
n= 100
r = (b-a).*rand(n,1) + a
m=mean(r)
![Using Matlab 1) The command rand(1) will generate a random number from the interval [0,1] from a uniformly distributed random generator. Use this command and a Using Matlab 1) The command rand(1) will generate a random number from the interval [0,1] from a uniformly distributed random generator. Use this command and a](/WebImages/32/using-matlab-1-the-command-rand1-will-generate-a-random-numb-1090854-1761574369-0.webp)