×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Random generation...

Random generation...

Random generation...

(OP)
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...

RE: Random generation...

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.

RE: Random generation...

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources