Python 生成均值为2 ,标准差为3 的一维正态分布样本500
import numpy as np
import scipy.stats as st
import matplotlib.pyplot as plt
s=np.random.normal(2, 3, 500)
s_fit = np.linspace(s.min(), s.max())
plt.plot(s_fit, st.norm(2, 3).pdf(s_fit), lw=2, c='r')
plt.show()
Python 生成均值为2 ,标准差为3 的一维正态分布样本500
import numpy as np
import scipy.stats as st
import matplotlib.pyplot as plt
s=np.random.normal(2, 3, 500)
s_fit = np.linspace(s.min(), s.max())
plt.plot(s_fit, st.norm(2, 3).pdf(s_fit), lw=2, c='r')
plt.show()