0
I have some questions in this code. I would like if someone could explain to me the functions.
from scipy.stats import binom
import matplotlib.pyplot as plt
import numpy as np
r=[2*i+1 for i in range(4)]
def single_bit_error(r, p=0.05):
return 1-binom.cdf(r//2, r, p)
def message_error(r, p=0.05):
return 1-(1-single_bit_error(r,p))**256
message_error(12)
plt.semilogy(r, [message_error(i) for i in r])`
What are the doubts? Did you make the code? If not, where did you get it? What should the code do?
– Woss
the code I did not do, I searched the net, it is a code of correction of errors in telecommunications, as it increases the number of repetitions decreases probability of error in the transmission, olink is this : https://Inst.eecs.Berkeley.edu/~ee126/fa14/lab/Lab11_viterbi.pdf and the doubts I have are where r//2 and message_error are(12)
– Sergio Nunes
@It’s still unclear what you want. The code is also not the best-filled of abbreviations, variables of a single letter, functions that do everything in a row... difficult to understand.
– Pablo Almeida
what it means r//2 and message_error(12) is just that
– Sergio Nunes
Pablo Almeida, how can I find an error correction code namely the repetition 3,5,7?
– Sergio Nunes
r//2
is entire division by2
, ensures that the result is aint
. Andmessage_error
is the function that was defined in the code itself! Taking an excerpt from the code:def message_error(r, p=0.05):
– Isac
Probably this code was executed in the python console. So, message_error(12) is just a test of the probability calculation function for r=12. // is the integer division operator.
– Felipe