demo1.py 文件源码

python
阅读 50 收藏 0 点赞 0 评论 0

项目:arlpy 作者: org-arl 项目源码 文件源码
def run_test(const, ebn0=range(21), syms=1000000):
    m = len(const)
    n = const.shape[1] if const.ndim == 2 else 1
    ber = []
    for s in ebn0:
        # eb is divided across n samples, and each symbol has m bits
        snr_per_sample = s + pow2db(np.log2(m)/n)
        d1 = comms.random_data(syms, m)
        x = comms.modulate(d1, const)
        if pb:
            x = comms.upconvert(x, fs_by_fd, fc, fs, pulse)
            # 3 dB extra SNR per sample needed to account for conjugate noise spectrum
            x = comms.awgn(x, snr_per_sample+3, complex=False)
            x = comms.downconvert(x, fs_by_fd, fc, fs, pulse)
            x = x[2*pulse_delay:-2*pulse_delay]
        else:
            x = comms.awgn(x, snr_per_sample, complex=True)
        d2 = comms.demodulate(x, const)
        ber.append(comms.ber(d1, d2, m))
    return ebn0, ber
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号