I'm new to python and I am trying to draw a graph for the probability of normal distribution of 1000 samples with specific mean and variance. The probability function is:
I have generated 1000 samples with:
import numpy as np
import matplotlib.pyplot as plt
s_mean = 0
s_variance = 0.1
s_std_dev = np.sqrt(s_variance)
s = np.random.normal(s_mean, 100, 1000)
I have managed to follow the function as much as I can:
prob_s = (np.exp(-1*((s-s_mean)**2)/(2*s_variance)))/(np.sqrt(2*np.pi)*s_std_dev)
and draw the graph using matplotlib:
f, (ax1) = plt.subplots(1, figsize=(5, 5))
ax1.hist(prob_s, bins=50, color='r')
plt.show()
but the graph is no where close to what I have expected:
The graph I was expecting is the following:
I can't find what's wrong here. Any help?