I'm in the middle of creating an autocorrelation code and just doesn't work. It is simple but I'm stuck and have no idea how to fix this code.
S1 = [1, 0, 1, 0, 0, 1]
func = 0;
for l in range(0,254):
for i in range (0,254):
if int(l+i) < 255:
func = (1-2*S1[i])*(1-2*(S1[i+l])
else :
func = (1-2*S1[i])*(1-2*(S1[(i+l)%2])
if func = 255 or 1 or -1
print ("R(%s) = %s " %l, %func)
There's a problem with the else statement but I'm not sure exactly what I did wrong.
Can you help me out?
Aucun commentaire:
Enregistrer un commentaire