comyx.fading
#
Package Summary#
Classes#
Represents the \(\text{Nakagami}(m, \Omega)\) distribution. |
|
Represents the \(\text{Rayleigh}(\sigma)\) distribution. |
|
Represents the \(\text{Rician}(K, \sigma)\) distribution. |
Functions#
|
Generates random variables from a distribution. |
Reference#
- class comyx.fading.Nakagami(m: float, omega: float = 1)[source]#
Represents the \(\text{Nakagami}(m, \Omega)\) distribution.
The Nakagami distribution or the Nakagami-m distribution is a probability distribution related to the gamma distribution. The family of Nakagami distributions has two parameters: a shape parameter \(m\) with \(m\geq 1/2\) and a second parameter controlling spread \(\Omega > 0\).
- Density Function
- \[f(x; m, \Omega) = \frac{2m^m}{\Gamma(m)\Omega^m} x^{2m - 1} \exp\left(-\frac{m}{\Omega}x^2\right)\]
, where \(\Gamma(.)\) is the gamma function.
- Expected value
- \[\sqrt{\frac{\Omega}{m}} \frac{\Gamma\left(m + \frac{1}{2}\right)}{\Gamma(m)}\]
- Variance
- \[\Omega \left(1 - \frac{1}{m}\left(\frac{\Gamma\left(m + \frac{1}{2}\right)}{\Gamma(m)}\right)^2\right)\]
- Reference:
- cdf(x: NDArrayFloat) NDArrayFloat [source]#
Cumulative distribution function of the Nakagami distribution.
- Parameters:
x – Value at which cdf is evaluated.
- Returns:
Value of the cumulative distribution function evaluated at x.
- get_samples(size: int | Tuple[int, Ellipsis], seed: int = None) NDArrayFloat [source]#
Generate random variables from the Nakagami distribution.
- Parameters:
size – Number of random variables to generate.
seed – Seed for the random number generator.
- Returns:
An array of size size containing random variables from the Nakagami distribution.
- class comyx.fading.Rayleigh(sigma: float = 1)[source]#
Represents the \(\text{Rayleigh}(\sigma)\) distribution.
The Rayleigh distribution is a continuous probability distribution for nonnegative-valued random variables. Up to rescaling, it coincides with the chi distribution with two degrees of freedom.
- Density function
- \[f(x; \sigma) = \frac{x}{\sigma^2} \cdot \exp\left(-\frac{x^2}{2\sigma^2}\right)\]
- Expected value
- \[\sigma \cdot \sqrt{\frac{\pi}{2}}\]
- Variance
- \[\left(2 - \frac{\pi}{2}\right) \cdot \sigma^2\]
- RMS value
- \[\sqrt{2} \cdot \sigma\]
- Reference:
- cdf(x: NDArrayFloat) NDArraySigned [source]#
Cumulative distribution function of the Rayleigh distribution.
- Parameters:
x – Value at which cdf is evaluated.
- Returns:
Value of the cumulative distribution function evaluated at x.
- get_samples(size: int | Tuple[int, Ellipsis], seed: int = None) NDArrayFloat [source]#
Generates random variables from the Rayleigh distribution.
- Parameters:
size – Number of random variables to generate.
seed – Seed for the random number generator.
- Returns:
An array of size size containing random variables from the Rayleigh distribution.
- class comyx.fading.Rician(K: float, sigma: float = 1)[source]#
Represents the \(\text{Rician}(K, \sigma)\) distribution.
The Rice distribution or Rician distribution (or, less commonly, Ricean distribution) is the probability distribution of the magnitude of a circularly-symmetric bivariate normal random variable, possibly with non-zero mean (noncentral).
- Density Function
- \[f(x; \nu, \sigma) = \frac{x}{\sigma^2} \exp\left(-\frac{x^2 + \nu^2}{2\sigma^2}\right) I_0\left(\frac{x\nu}{\sigma^2}\right)\]
, where \(I_0\) is the modified Bessel function of the first kind.
- Expected value
- \[\sigma \sqrt{\frac{\pi}{2}} \exp\left(-\frac{\nu^2}{2\sigma^2}\right)\]
- Variance
- \[2\sigma^2 + \nu^2 - \frac{\pi\sigma^2}{2}\]
- RMS value
- \[\sigma \sqrt{2 + \frac{\pi}{2}}\]
- Reference:
- cdf(x: NDArrayFloat) NDArrayFloat [source]#
Cumulative distribution function of the the Rician distribution.
- Parameters:
x – Value at which cdf is evaluated.
- Returns:
Value of the cumulative distribution function evaluated at x.
- get_samples(size: int | Tuple[int, Ellipsis], seed: int = None) NDArrayFloat [source]#
Generate random variables from the Rician distribution.
- Parameters:
size – Nnumber of random variables to generate.
seed – Seed for the random number generator.
- Returns:
An array of size size containing random variables from the Rician distribution.
- comyx.fading.get_rvs(shape: int | Tuple[int, Ellipsis], type: str, seed: int | None = None, *args, **kwargs) NDArrayComplex [source]#
Generates random variables from a distribution.
- Rayleigh
sigma
- Scale parameter of the Rayleigh distribution.
- Rician
K
- Rician K-factor in dB.sigma
- Scale parameter of the Rician distribution.
- Nakagami
m
- Shape parameter of the Nakagami distribution.omega
- Scale parameter of the Nakagami distribution.
- Parameters:
shape – Number of fading samples to generate.
type – Type of the fading. (“rayleigh”, “rician”, “nakagami”)
seed – Seed for the random number generator.
- Returns:
Channel gains.