“Python/numpy random rayleigh”的版本间差异

来自菜鸟教程
跳转至:导航、​搜索
(Pywikibot 4.4.0.dev0)
 
(机器人:添加分类Python基础教程
 
第52行: 第52行:
  
 
<br />
 
<br />
 +
 +
[[分类:Python基础教程]]

2020年10月29日 (四) 08:49的最新版本

<languages />

瑞利分布

瑞利分布

瑞利分布用于信号处理。

它有两个参数:

scale -(标准差)决定分布默认为1.0的平坦程度。

size -返回数组的形状。

绘制一个样本,用于瑞利分布,比例为2,大小为2x3:

  from numpy import random

x = random.rayleigh(scale=2, size=(2, 3))

print(x)

瑞利分布的可视化

  from numpy import random
import matplotlib.pyplot as plt
import seaborn as sns


sns.distplot(random.rayleigh(size=1000), hist=False)

plt.show()

结果

文件:Rayleigh1.png


瑞利和卡方分布之间的相似性

在单位stddev和2自由度处,瑞利和卡方表示相同的分布。