Create a gaussian distributionΒΆ

In this example we are going to create a gaussian distribution with parameters

\mu = 2.2, \sigma = 0.6

from __future__ import print_function
import openturns as ot
import openturns.viewer as viewer
from matplotlib import pylab as plt
ot.Log.Show(ot.Log.NONE)

distribution = ot.Normal(2.2, 0.6)
print(distribution)

Out:

Normal(mu = 2.2, sigma = 0.6)
sample = distribution.getSample(10)
print(sample)

Out:

    [ X0      ]
0 : [ 3.52252 ]
1 : [ 1.98154 ]
2 : [ 2.71262 ]
3 : [ 2.23047 ]
4 : [ 2.95334 ]
5 : [ 2.25199 ]
6 : [ 2.53609 ]
7 : [ 2.3081  ]
8 : [ 1.71475 ]
9 : [ 2.47636 ]
graph = distribution.drawPDF()
view = viewer.View(graph)
plt.show()
plot gaussian distribution

Total running time of the script: ( 0 minutes 0.069 seconds)

Gallery generated by Sphinx-Gallery