rand(1) returns one pseudo random number between 0 and 1 correct? (I don't know matlab myself but I know what you can do with the random number)

Use the Box-Muller transform.

This transform says is standard deviation σ.


mu = 5; //enter the mean you want or need
sigma = 3; //enter the standard deviation you want or need

u1 = rand(1);
u2 = rand(2);

z1 = sqrt(-2 * Log[u1]) * Sin[2 *pi * u2];
z2 = sqrt(-2 * Log[u1]) * Cos[2 * pi * u2];

x1 = mu + z1 * sigma;
x2 = mu + z2 * sigma;

 

http://www.taygeta.com/random/gaussian.html

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-05-31
  • 2021-09-30
  • 2022-01-22
  • 2022-12-23
  • 2021-12-11
  • 2021-12-17
猜你喜欢
  • 2021-11-18
  • 2021-08-22
  • 2021-08-04
  • 2022-12-23
  • 2021-12-31
  • 2022-12-23
  • 2021-09-15
相关资源
相似解决方案