Skip to content

SNR Noise

__init__(snr=15, seed=None, length_multiplier=1, position_factor=0.5)

Implementation of AWGN noise \(r(t)\), based on \(SNR_{dB}\).

Parameters:

Name Type Description Default
snr float

Signal-to-noise ratio in decibels (dB).

15
seed int

Seed of the random number generator.

None
length_multiplier float

Multiplier of the signal length.

1
position_factor float

Position factor of the noise.

0.5

Examples:

>>> import argos3
>>> import numpy as np 
>>> 
>>> transmitter = argos3.Transmitter(fc=2400, output_print=False, output_plot=False)
>>> t, s = transmitter.transmit(argos3.Datagram(pcdnum=1234, numblocks=1))
>>> 
>>> noise = argos3.Noise(snr=15, seed=11)
>>> s_prime = noise.add_noise(s)
>>>                   
>>> receiver = argos3.Receiver(fc=2400, output_print=False, output_plot=False)
>>> datagramRX, success = receiver.receive(s_prime)
>>> 
>>> print(success)
True
>>> print(datagramRX.parse_datagram())
{
  "msglength": 1,
  "pcdid": 1234,
  "data": {
    "bloco_1": {
      "sensor_1": 37,
      "sensor_2": 198,
      "sensor_3": 9
    }
  },
  "tail": 7
}
  • Time Domain Plot Example: pageplot
  • Frequency Domain Plot Example: pageplot

add_noise(signal)

Adds AWGN noise \(n(t)\) to the input signal \(s(t)\), based on the \(\mathrm{SNR}_{dB}\) defined in initialization.

\[ r(t) = s(t) + n(t), \qquad n(t) \sim \mathcal{N}(0, \sigma^2) \]
Where
  • \(r(t)\): Signal returned with AWGN noise added.
  • \(s(t)\): Input signal without noise.
  • \(n(t)\): Noise added, with normal distribution \(\mathcal{N}(0, \sigma^2)\).

The noise variance \(\sigma^2\) is given by:

\[ \sigma^2 = \frac{\mathbb{E}\!\left[ |s(t)|^2 \right]}{10^{\frac{\mathrm{SNR}_{dB}}{10}}} \]
Where
  • \(\sigma^2\): Noise variance.
  • \(\mathbb{E}\!\left[ |s(t)|^2 \right]\): Input signal power.
  • \(\mathrm{SNR}_{dB}\): Signal-to-noise ratio in decibels (dB).

Parameters:

Name Type Description Default
signal ndarray

Input signal \(s(t)\).

required

Returns:

Name Type Description
signal ndarray

Signal \(r(t)\), with AWGN noise added.

Examples:

  • Noise Density Plot Example: pageplot