Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Random generation...

Status
Not open for further replies.

kerekgmwe

Computer
Oct 6, 2005
1
Hello i have a random variable X and want to create 8000 random generated numbers for it with uniform destribution...how do i do it in matlab ? i know that unifrnd(0,1) creates ONE random number between 0 and 1...how do i generate 8000 ? thanks...
 
Replies continue below

Recommended for you

Hello.

You could use the following command.

random = unifrnd(0,1,1,8000);

This creates 8000 random variables uniformly distributed between [0,1]. The info is stored in the vector named random.

 
Hi,
to generate an array of length X you can use:
rand_seq = rand(1,X);
This distribution is a continous uniform distribution from 0 to 1 with mean value 0.5.
If you want to create any uniform distribution you can use
rand_seq = V*rand(1,X) + Offset;
In this case V*rand(1,X) generates a c.u.d from 0 to V and you can use Offset to set the mean value of the ditribution.
Example:
rand_seq = 10*rand(1,X) - 5;
generates a c.u.d. from -5 to 5

Hi
lurad75
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor