Created
October 30, 2025 13:07
-
-
Save kumanna/65e06b42402e7bb3d57dc3652714c1fa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| N = 100 | |
| bpsk_data = np.sign(np.random.randn(N)) | |
| h = np.array([1, 0.25, -0.25]) | |
| y = np.convolve(h, bpsk_data) | |
| L = 4 | |
| R = np.zeros((L, L)) | |
| p = np.zeros(L) | |
| for i in range(50): | |
| r = y[i:i + L] | |
| R = R + np.outer(r, r) | |
| p = p + bpsk_data[i] * r | |
| c = np.linalg.inv(R) @ p | |
| data_to_plot = [] | |
| for i in range(51, 99): | |
| r = y[i:i + L] | |
| b_hat = np.sign(c @ r) | |
| print((bpsk_data[i], b_hat)) | |
| data_to_plot.append(b_hat) | |
| plt.stem(bpsk_data[51:], 'r:') | |
| plt.stem(data_to_plot, 'k--') | |
| plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment