Matlab Distribution Sampling

77 views Asked by At

How can I create a vector x in Matlab that has values between 0.8 and 1.2, randomly sampled from a: 1. Uniform 2. Normal distribution?

There are a lot of functions dealing with distributions, but I'm having trouble using them properly.

1

There are 1 answers

0
Mikhail_Sam On BEST ANSWER

So, you can use this, for example:

y = 0.8 + rand*0.4;

this will generate random number between 0.8 and 1.2. because rand creates uniform distribution I believe that rand*0.4 creates the same ;)