Normal(Gaussian) Distribution Function in C++

前端 未结 3 2108
遥遥无期
遥遥无期 2021-01-28 21:00

I need to know a way to have the Gaussian Distribution of 50 numbers. I know of the Boost library, which generates random numbers. In my case, I don\'t need random numbers; I ne

3条回答
  •  忘了有多久
    2021-01-28 21:32

    If I got your question right you looking for the estimated normal distribution, that is for the sample mean and the variance of the sample .

    The former is calculated as:

    and the latter as:

    The sample mean can be used as expected value and the sample variance as enter image description here in the gaussian distribution:

    If you want more information check out:

    • http://mathworld.wolfram.com/SampleVariance.html
    • http://en.wikipedia.org/wiki/Sample_mean_and_sample_covariance

    I hope that answered your question ;)

提交回复
热议问题