使用Python绘制正态分布曲线,借助matplotlib绘图工具;
#-*-coding:utf-8-*-
"""
python绘制标准正态分布曲线
"""
# ==============================================================
import numpy as np
import math
import matplotlib.pyplot as plt
def gd(x, mu=0, sigma=1):
"""根据公式,由自变量x计算因变量的值
Argument:
x: array
输入数据(自变量)
mu: float
均值
sigma: float
方差
"""
left = 1 / (np.sqrt(2 * math.pi) * np.sqrt(sigma))
right = np.exp(-(x - mu)**2 / (2 * sig