代码拉取完成,页面将自动刷新
同步操作将从 zhoub86/PAPR-net 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import numpy as np
import matplotlib.pyplot as plt
from ofdm import OFDMTransmitter, OFDMReceiver
from signals import papr_calc, awgn, ber_subcarrier_calc
from initialize.params import channel, h, bit_allocation, coef
params = dict()
params['BitAllocation'] = bit_allocation
params['Coef'] = coef
params['OverSampleRate'] = 4
params['CPLength'] = 100
symbol_num = 1000
bits_per_symbol = np.sum(params['BitAllocation'])
bit_send = np.random.randint(0, 2, bits_per_symbol * symbol_num)
tx = OFDMTransmitter(**params)
sig = tx.transmit(bit_send, encoder='training/encoder_30.hdf5', papr_net=True)
papr = papr_calc(sig)
plt.figure(1)
plt.plot(sig[0: 10 * 2148])
plt.show()
sig_recv = np.convolve(sig, h)[0: len(sig)]
sig_recv = awgn(sig_recv, snr=20)
rx = OFDMReceiver(**params)
bit_recv = rx.receive(sig_recv, shift=rx.CPLength, channel=channel,
decoder='training/decoder_30.hdf5', papr_net=True)
ber = np.sum(np.logical_xor(bit_send, bit_recv)) / bit_send.size
print('PAPR = %.4f\nBER = %.6f' % (papr, ber))
ber_subcarrier = ber_subcarrier_calc(bit_send, bit_recv, bit_allocation)
plt.figure(2)
plt.plot(ber_subcarrier, marker='o')
plt.show()
# rx = OFDMReceiver(**params)
# ofdm_chunks = rx.get_recv_qam(sig_recv, shift=rx.CPLength, channel=channel,
# decoder='training/decoder_30.hdf5', papr_net=True)
#
# k = 0
# plt.figure(1)
# plt.scatter(ofdm_chunks[:, k].real, ofdm_chunks[:, k].imag)
# plt.show()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。