hamnet70-gnuradio-legacy/utils/make_preamble.py

22 lines
387 B
Python
Raw Normal View History

#!/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()