Created
March 4, 2025 11:09
-
-
Save kumanna/b88ccf186f35a825cd15822eb741de29 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 | |
# We always send +1 | |
delta_omega = 0.01 * np.pi | |
n = np.arange(100) | |
received_symbols = np.exp(1j * delta_omega * n) # AWGN here | |
#plt.scatter(np.real(received_symbols), np.imag(received_symbols)) | |
#plt.show() | |
quantized_points = np.array([1, -1, 1j, -1j]) | |
indices = np.argmin(np.abs( | |
np.outer(received_symbols, [1, 1, 1, 1]) - \ | |
np.outer(np.ones(100), | |
np.array(quantized_points))), axis=1) | |
quantized_received_symbols = quantized_points[indices] | |
# Sanity check of quantization | |
plt.plot(np.real(received_symbols)) | |
plt.plot(np.real(quantized_received_symbols)) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment