Error correction code (repetition)

Asked

Viewed 64 times

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])`
  • 1

    What are the doubts? Did you make the code? If not, where did you get it? What should the code do?

  • 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)

  • @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.

  • what it means r//2 and message_error(12) is just that

  • Pablo Almeida, how can I find an error correction code namely the repetition 3,5,7?

  • r//2 is entire division by 2, ensures that the result is a int. And message_error is the function that was defined in the code itself! Taking an excerpt from the code: def message_error(r, p=0.05):

  • 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.

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.