Question: explanation the differences of the below Parity Check Simulation (python 2.7) codes def ErrorChannel(coded): received=copy.copy(coded) for i in range(len(coded)): rand=random.random() if rand
explanation the differences of the below Parity Check Simulation (python 2.7) codes
def ErrorChannel(coded): received=copy.copy(coded) for i in range(len(coded)): rand=random.random() if rand<=0.02: received[i]=1-received[i] return received
VS
def ErrorChannel(coded)
received=copy.copy(coded)
flag=0;
for i in range(len(coded)-1):
rand=random.random()
x=rand
if flag==1:
flag=0
elif (x<=0.1) & (flag==0):
received[i]=1-received[i]
received[i+1]=1-received[i+1] flag=1
return received
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
