def plot(seq):
"""Plot the autocorrelation of the given sequence."""
import matplotlib.pyplot as plt
bipolar = np.where(seq, 1.0, -1.0)
autocorr = np.correlate(bipolar, bipolar, 'same')
plt.figure()
plt.title("Length {} Gold code autocorrelation".format(len(seq)))
xdata = np.arange(len(seq)) - len(seq) // 2
plt.plot(xdata, autocorr, '.-')
plt.show()
评论列表
文章目录