用matplotlib.pyplot实现正态分布函数的图像绘制

下面是一个正态分布的例子,介绍的很详细,通过对引用函数的改变还可以绘制诸如卡方分布,t分布等常见分布函数的绘制。

如需其他分布函数代码,可以查看我上传的代码文件,里面还包括了柯布-道格拉斯函数三维分布的函数图像。

Let 𝑋 be a random variable that follows the normal distribution, i.e.,

𝑋∼𝑁(𝑎,𝑏2),X∼N(a,b2),

where 𝑎 is the mean of X, and 𝑏 is the standard deviation of 𝑋.

  1. Plot the probability density function of 𝑋X when 𝑎=0a=0 and 𝑏=1,2,4b=1,2,4.
  2. Plot the cumulative distribution function of 𝑋X when 𝑎=0a=0 and 𝑏=1,2,4b=1,2,4.
  3. #第一问
    import numpy as np
    from scipy import stats
    import matplotlib.pyplot as plt
    mean=0
    #定义函数:stats.norm(a,b)为正态分布的函数;stats.chi2为卡方分布的函数;stats.t为T分布的函数
    normalDistribution=stats.norm(mean,1)
    #标准差=2的正态分布
    normalDistribution1=stats.norm(mean,2)
    #标准差=4的正态分布
    normalDistribution2=st
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值