2025年11月4日 星期二

QPSK 基頻信號星座图

 QPSK 基頻信號星座图




import numpy as np

import matplotlib.pyplot as plt


num_symbols = 1000


x_int = np.random.randint(0, 4, num_symbols) # 0 to 3

x_degrees = x_int*360/4.0 + 45 # 45, 135, 225, 315 度

x_radians = x_degrees*np.pi/180.0 # sin() 和 cos() 以弧度为输入

x_symbols = np.cos(x_radians) + 1j*np.sin(x_radians) # 生成 QPSK 复数符号

plt.plot(np.real(x_symbols), np.imag(x_symbols), '.')

plt.grid(True)

plt.show()


n = (np.random.randn(num_symbols) + 1j*np.random.randn(num_symbols))/np.sqrt(2) # 具备单位功率噪音的 AWGN

noise_power = 0.01

r = x_symbols + n * np.sqrt(noise_power)

plt.plot(np.real(r), np.imag(r), '.')

plt.grid(True)

plt.show()


沒有留言:

張貼留言

2026-09 mqtt 實驗3

 2026-09 mqtt 實驗3 node-red參考網址 https://sites.google.com/gm.lhu.edu.tw/charlesho/service/aiot?pli=1&authuser=0#h.m7oahj9kmy1d Node-RED入門課...