python 正态分布密度函数
时间: 2023-09-10 11:12:11 浏览: 171
正态分布密度函数毕业设计.doc
Python中,可以使用SciPy库的stats模块来计算正态分布的概率密度函数。具体代码如下:
```python
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
x = np.linspace(-5, 5, 100) # 生成一组x值
y = norm.pdf(x, 0, 1) # 计算正态分布的概率密度函数值
plt.plot(x, y)
plt.xlabel('x')
plt.ylabel('Probability Density')
plt.title('Normal Distribution PDF')
plt.show()
```
其中,norm.pdf函数用于计算正态分布的概率密度函数值,参数依次为x值、均值和标准差。以上代码将生成一个从-5到5的x坐标范围内的正态分布概率密度函数图形。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [python 服从正态分布下概率密度函数](https://blog.csdn.net/with_still_water/article/details/102493308)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.268^v1^control"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [给定概率密度,生成随机数 python实现](https://blog.csdn.net/normol/article/details/98968528)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.268^v1^control"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文