Untitled
unknown
python
3 years ago
340 B
25
Indexable
def awgn(x, snr):
import math
rng = np.random.default_rng(0) # no cambie esta línea
# YOUR CODE HERE
mu = 0
N = len(x)
px = (1/N)*np.sum(np.abs(x)**2)
snr = 10**(snr/10)
pn = px / snr
sol = rng.normal(0, np.sqrt(pn / 2), N)
y = sol + 1j*rng.normal(0, np.sqrt(pn/2), N)
return y + x
Editor is loading...