22 lines
387 B
Python
22 lines
387 B
Python
|
#!/usr/bin/env python3
|
||
|
|
||
|
import numpy as np
|
||
|
import matplotlib.pyplot as pp
|
||
|
|
||
|
min_err = 100
|
||
|
|
||
|
pre = np.array([1]*64 + [-1]*64)
|
||
|
|
||
|
while min_err > 10:
|
||
|
pre = np.random.permutation( pre )
|
||
|
c = np.correlate(pre, pre, mode='full')
|
||
|
err = np.max(np.absolute(c[:127]))
|
||
|
|
||
|
if err < min_err:
|
||
|
min_err = err
|
||
|
print(err)
|
||
|
print(pre)
|
||
|
pp.plot(c)
|
||
|
pp.show()
|
||
|
|