Digital Modulation
Est. read time: 1 minute | Last updated: July 13, 2025 by John Gentile
Contents
- Phase Shift-Keying (PSK)
- Direct Sequence Spread Spectrum (DSSS) / Code Division Multiple Access (CDMA)
- OFDM
- References
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
from rfproto import filter, modulation, plot, sig_gen
Phase Shift-Keying (PSK)
Binary Phase-Shift Keying (BPSK)
Quadrature Phase-Shift Keying (QPSK)
Direct Sequence Spread Spectrum (DSSS) / Code Division Multiple Access (CDMA)
data_bits = np.array([1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0]) # 11-bit barker code
bpsk_symbols = 2 * data_bits - 1
print(f"BPSK symbols: {bpsk_symbols}")
BPSK symbols: [ 1 -1 1 1 -1 1 1 1 -1 -1 -1]
tx = np.concatenate([bpsk_symbols, bpsk_symbols, bpsk_symbols, bpsk_symbols, bpsk_symbols, bpsk_symbols])
# sliding correlation of the transmitted sequence with the reference code:
result = np.correlate(tx,bpsk_symbols, mode='full')
plt.plot(result)
plt.show()
print(max(result))
11
tx = np.zeros(100)
tx[21:21+len(bpsk_symbols)] = bpsk_symbols
tx += np.random.normal(-0.5, 0.5, 100)
plt.plot(tx)
plt.show()
result = np.correlate(tx,bpsk_symbols, mode='full')
plt.plot(result)
plt.show()
print(f"Max correlation of {max(result)} at {list(result).index(max(result))}")
Max correlation of 8.722090712649463 at 31
OFDM
from IPython.display import YouTubeVideo
YouTubeVideo('1rpoUqx0360')
YouTubeVideo('UCRildDdrX4')