Gaussian distribution with randn
Show older comments
Is it possible and how can i obtain a Gaussian distribution with randn for
mean= 0.126
and it varies by+- 0.02, max=0.146 and min=0.106,
to generate 1300 random values.
2 Comments
Rik
on 14 Nov 2017
Have you read the documentation (just type doc randn)? You'll need to shift the mean, change the width of the distribution and do something about values outside your range. Think carefully about the order in which you do these.
Joseph Lee
on 14 Nov 2017
Accepted Answer
More Answers (1)
By definition, a gaussian distribution covers the whole range [-∞, +∞]. If your distribution has a min and max it's not gaussian anymore.
Furthermore, a gaussian distribution is defined by a mean and a standard deviation, not a mean and a range. If a gaussian distribution has a standard deviation of 0.02, you'll still find about 32% of the samples outside of that ±0.02 range.
1 Comment
Joseph Lee
on 14 Nov 2017
Categories
Find more on Random Number Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!