Skip to content

Commit

Permalink
Update iq_files.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
accessbox777 authored Mar 31, 2024
1 parent 16d6436 commit 7a20af3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions content/iq_files.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ In Python, and numpy specifically, we use the :code:`tofile()` function to store
num_symbols = 10000
# x_symbols array will contain complex numbers representing the QPSK symbols. Each symbol will be a complex number with a magnitude of 1 and a phase angle corresponding to one of the four QPSK constellation points (45, 135, 225, or 315 degrees)
# x_symbols array will contain complex numbers representing the QPSK symbols. Each symbol will be a complex number with a magnitude of 1 and a phase angle corresponding to one of the four QPSK constellation points (45, 135, 225, or 315 degrees)
x_int = np.random.randint(0, 4, num_symbols) # 0 to 3
x_degrees = x_int*360/4.0 + 45 # 45, 135, 225, 315 degrees
x_radians = x_degrees*np.pi/180.0 # sin() and cos() takes in radians
x_symbols = np.cos(x_radians) + 1j*np.sin(x_radians) # this produces our QPSK complex symbols
x_degrees = x_int*360/4.0 + 45 # 45, 135, 225, 315 degrees
x_radians = x_degrees*np.pi/180.0 # sin() and cos() takes in radians
x_symbols = np.cos(x_radians) + 1j*np.sin(x_radians) # this produces our QPSK complex symbols
n = (np.random.randn(num_symbols) + 1j*np.random.randn(num_symbols))/np.sqrt(2) # AWGN with unity power
r = x_symbols + n * np.sqrt(0.01) # noise power of 0.01
print(r)
Expand Down

0 comments on commit 7a20af3

Please sign in to comment.