Rayleigh Distribution

🌊 Rayleigh Distribution in Python

The Rayleigh distribution is a continuous probability distribution often used in signal processing, communications, and reliability analysis. It describes the magnitude of a vector with two independent, normally distributed components.


 1. Characteristics of Rayleigh Distribution

  • Continuous distribution

  • Parameter: scale = σ (standard deviation of underlying normal distributions)

  • Values ≥ 0

  • PDF (Probability Density Function):

f(x;σ)=xσ2e−x2/(2σ2),x≥0f(x; \sigma) = \frac{x}{\sigma^2} e^{-x^2/(2\sigma^2)}, \quad x \ge 0

Applications:

  • Modeling wind speed

  • Magnitude of noise in communication signals

  • Reliability of mechanical components


 2. Generate Rayleigh Data Using NumPy


 

Output (example):

[0.89, 1.45, 3.12, 2.34, 0.56, 1.78, 2.90, 0.45, 3.45, 1.23]
  • All values ≥ 0

  • Distribution is right-skewed


 3. Visualize Rayleigh Distribution


 

  • Right-skewed

  • Peak occurs near scale


4. Compare Different Scale Parameters


 

  • Smaller scale → peak closer to 0

  • Larger scale → distribution spreads out


 5. Compute Mean and Standard Deviation

  • Mean ≈ scale * √(π/2)

  • Standard deviation ≈ scale * √((4-π)/2)


🧠 Summary Table

Function Parameters Description
np.random.rayleigh() scale, size Generates Rayleigh random numbers
scale Standard deviation Determines spread of distribution
size Number of samples Output array size

🎯 Practice Exercises

  1. Generate 1000 Rayleigh random numbers with scale=1.5 and plot histogram with KDE.

  2. Compare Rayleigh distributions for scale=1, scale=2, scale=4.

  3. Compute the mean and standard deviation and compare with theoretical formulas.

You may also like...