Created
August 28, 2017 14:40
-
-
Save tsutarou10/864bcd773b8d046ed2e8af70ca83f23e to your computer and use it in GitHub Desktop.
ガウス分布 (1次の場合)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding: utf-8 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
def norm(x,mu,sigma): | |
return 1 / pow(2*np.pi*sigma,0.5) * np.exp(-0.5*pow(x-mu,2)/sigma) | |
if __name__ == "__main__": | |
N = 1000 | |
x = np.linspace(-6,6, N) | |
mu = [0.0,-3.4,1.5] | |
sigma = [1.0,0.25,4.41] | |
for m,s in zip(mu,sigma): | |
y = norm(x,m,s) | |
plt.plot(x,y,label = "meam = " + str(m) + " variance = " + str(s)) | |
plt.legend(loc = "upper right") | |
plt.title("Univariate Normal Distribution") | |
plt.savefig("univariate_normal.png") | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment