Skip to content

Probability

NoiseAWGN

Bases: randomVariable

Class for generating AWGN (Additive White Gaussian Noise).

\[ \begin{equation} p(n) = \frac{1}{\sqrt{2\pi\sigma^2}} e^{-\frac{n^2}{2\sigma^2}} \end{equation} \]
Where
  • \(p(n)\) is the probability density function of the noise.
  • \(\sigma^2_n\) is the variance of the noise (\(\sigma^2_n = \mathbb{E}[n^2]\))

__init__(sigma=1, u=0, seed=None, n=None)

Initialize the NoiseAWGN class.

Parameters:

Name Type Description Default
sigma float

Standard deviation of the noise.

1
u float

Mean of the noise.

0
seed int

Seed for the random number generator.

None
n int

Number of samples to generate on initialization.

None

generate(n)

Generate AWGN samples using np.random.normal function.

Returns:

Name Type Description
samples ndarray

Generated AWGN samples.

pdf(n=None, span=5)

Compute the Gaussian PDF exactly as in the formula below:

\[ \begin{equation} p(n) = \frac{1}{\sqrt{2\pi\sigma^2}} e^{-\frac{n^2}{2\sigma^2}} \end{equation} \]
Where
  • \(p(n)\) is the probability density function of the noise.
  • \(\sigma^2_n\) is the variance of the noise (\(\sigma^2_n = \mathbb{E}[n^2]\))

Parameters:

Name Type Description Default
n int, array, or None

Number of points or points to calculate PDF for.

None
span float

Span in multiples of sigma.

5

Returns:

Name Type Description
pdf ndarray

Gaussian PDF values.