Plotting of 1-dimensional Gaussian distribution function

后端 未结 5 424
忘掉有多难
忘掉有多难 2021-02-04 01:09

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 n

5条回答
  •  北海茫月
    2021-02-04 01:49

    The correct form, based on the original syntax, and correctly normalized is:

    def gaussian(x, mu, sig):
        return 1./(np.sqrt(2.*np.pi)*sig)*np.exp(-np.power((x - mu)/sig, 2.)/2)
    

提交回复
热议问题