Curriculum
Course: NumPy
Login

Curriculum

NumPy

Text lesson

Rayleigh Distribution

The Rayleigh distribution is commonly used in signal processing. It has two parameters:

scale (standard deviation): Determines the spread of the distribution (default is 1.0).

size: Specifies the shape of the returned array.

Example

Generate a sample from the Rayleigh distribution with a scale of 2 and a size of 2×3.

from numpy import random

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

print(x)

Visualization of Rayleigh Distribution

Example

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

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

plt.show()

Result

rayleigh1

Similarity Between Rayleigh and Chi Square Distribution

At a unit standard deviation and 2 degrees of freedom, the Rayleigh and Chi-Square distributions represent the same distribution.