How do I make plots of a 1-dimensional Gaussian distribution function using the mean and standard deviation parameter values (μ, σ) = (−1, 1), (0, 2), and (2, 3)?
I'm new to programming, using Python.
Thank you in advance!
In statistics and probability theory, the Gaussian distribution is a continuous distribution that gives a good description of data that cluster around a mean. The graph or plot of the associated probability density has a peak at the mean, and is known as the Gaussian function or bell curve. p1 = -. 5 * ((x - mu)/s) .
The Gaussian distribution is also commonly called the "normal distribution" and is often described as a "bell-shaped curve". If the probability of a single event is p = and there are n = events, then the value of the Gaussian distribution function at value x = is x 10^ .
With the excellent matplotlib
and numpy
packages
from matplotlib import pyplot as mp import numpy as np def gaussian(x, mu, sig): return np.exp(-np.power(x - mu, 2.) / (2 * np.power(sig, 2.))) x_values = np.linspace(-3, 3, 120) for mu, sig in [(-1, 1), (0, 2), (2, 3)]: mp.plot(x_values, gaussian(x_values, mu, sig)) mp.show()
will produce something like
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With