资源简介

本资源是文献Power of Deep Learning for Channel Estimation and Signal Detection in OFDM Systems的代码部分

资源截图

代码片段和文件信息

from __future__ import division
import numpy as np
import scipy.interpolate 
import tensorflow as tf
import math
import os
K = 64
CP = K//4
P = 64 # number of pilot carriers per OFDM block
#pilotValue = 1+1j
allCarriers = np.arange(K)  # indices of all subcarriers ([0 1 ... K-1])
pilotCarriers = allCarriers[::K//P] # Pilots is every (K/P)th carrier.
#pilotCarriers = np.hstack([pilotCarriers np.array([allCarriers[-1]])])
#P = P+1
dataCarriers = np.delete(allCarriers pilotCarriers)
mu = 2
payloadBits_per_OFDM = len(dataCarriers)*mu  # number of payload bits per OFDM symbol

payloadBits_per_OFDM = K*mu

SNRdb = 20  # signal to noise-ratio in dB at the receiver 

mapping_table = {
    (00) : -1-1j
    (01) : -1+1j
    (10) : 1-1j
    (11) : 1+1j
}

demapping_table = {v : k for k v in mapping_table.items()}

def Modulation(bits):                                        
    bit_r = bits.reshape((int(len(bits)/mu) mu))                  
    return (2*bit_r[:0]-1)+1j*(2*bit_r[:1]-1)                                    # This is just for QAM modulation

def OFDM_symbol(Data pilot_flag):
    symbol = np.zeros(K dtype=complex) # the overall K subcarriers
    #symbol = np.zeros(K) 
    symbol[pilotCarriers] = pilotValue  # allocate the pilot subcarriers 
    symbol[dataCarriers] = Data  # allocate the pilot subcarriers
    return symbol

def IDFT(OFDM_data):
    return np.fft.ifft(OFDM_data)

def addCP(OFDM_time):
    cp = OFDM_time[-CP:]               # take the last CP samples ...
    return np.hstack([cp OFDM_time])  # ... and add them to the beginning

def channel(signalchannelResponseSNRdb):
    convolved = np.convolve(signal channelResponse)
    signal_power = np.mean(abs(convolved**2))
    sigma2 = signal_power * 10**(-SNRdb/10)  
    noise = np.sqrt(sigma2/2) * (np.random.randn(*convolved.shape)+1j*np.random.randn(*convolved.shape))
    return convolved + noise

def removeCP(signal):
    return signal[CP:(CP+K)]

def DFT(OFDM_RX):
    return np.fft.fft(OFDM_RX)


def equalize(OFDM_demod Hest):
    return OFDM_demod / Hest

def get_payload(equalized):
    return equalized[dataCarriers]


def PS(bits):
    return bits.reshape((-1))




def ofdm_simulate(codeword channelResponseSNRdb):       
    OFDM_data = np.zeros(K dtype=complex)
    OFDM_data[allCarriers] = pilotValue
    OFDM_time = IDFT(OFDM_data)
    OFDM_withCP = addCP(OFDM_time)
    OFDM_TX = OFDM_withCP
    OFDM_RX = channel(OFDM_TX channelResponseSNRdb)
    OFDM_RX_noCP = removeCP(OFDM_RX)

    # ----- target inputs ---
    symbol = np.zeros(K dtype=complex)
    codeword_qam = Modulation(codeword)
    symbol[np.arange(K)] = codeword_qam
    OFDM_data_codeword = symbol
    OFDM_time_codeword = np.fft.ifft(OFDM_data_codeword)
    OFDM_withCP_cordword = addCP(OFDM_time_codeword)
    OFDM_RX_codeword = channel(OFDM_withCP_cordword channelResponseSNRdb)
    OFDM_RX_noCP_codeword = removeCP(OFDM_RX_codeword)
    return np.concatenate((np.concatenate((np.real(OFDM_RX_

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    .......     11738  2017-12-22 04:06  Power of Deep Learning for Channel Estimation and Signal Detection in OFDM Systems\DNN_Detection\Example.py

     文件      14320  2018-11-16 14:27  Power of Deep Learning for Channel Estimation and Signal Detection in OFDM Systems\DNN_Detection\Example_read.py

     文件        590  2018-11-16 09:32  Power of Deep Learning for Channel Estimation and Signal Detection in OFDM Systems\DNN_Detection\Main.py

     文件      13436  2018-11-21 14:11  Power of Deep Learning for Channel Estimation and Signal Detection in OFDM Systems\DNN_Detection\OFDM_ChannelEstimation_DeepLearning_QAM_random_pilot.py

    .......     15348  2017-12-22 04:06  Power of Deep Learning for Channel Estimation and Signal Detection in OFDM Systems\DNN_Detection\OFDM_ChannelEstimation_DeepLearning_QAM_random_pilot_withoutCP.py

    .......     14999  2017-12-22 04:06  Power of Deep Learning for Channel Estimation and Signal Detection in OFDM Systems\DNN_Detection\OFDM_ChannelEstimation_DeepLearning_QAM_random_pilot_with_different_pilots.py

     文件        881  2018-11-16 10:06  Power of Deep Learning for Channel Estimation and Signal Detection in OFDM Systems\DNN_Detection\partial test.py

    .......       800  2017-12-22 04:06  Power of Deep Learning for Channel Estimation and Signal Detection in OFDM Systems\DNN_Detection\Pilot_16

    .......      3200  2017-12-22 04:06  Power of Deep Learning for Channel Estimation and Signal Detection in OFDM Systems\DNN_Detection\Pilot_64

    .......       400  2017-12-22 04:06  Power of Deep Learning for Channel Estimation and Signal Detection in OFDM Systems\DNN_Detection\Pilot_8

     文件        232  2018-11-15 18:41  Power of Deep Learning for Channel Estimation and Signal Detection in OFDM Systems\DNN_Detection\ReadMe.txt

    .......      6374  2017-12-22 04:06  Power of Deep Learning for Channel Estimation and Signal Detection in OFDM Systems\DNN_Detection\Test.py

     文件       9998  2018-11-16 12:28  Power of Deep Learning for Channel Estimation and Signal Detection in OFDM Systems\DNN_Detection\Train.py

    .......      6582  2017-12-22 04:06  Power of Deep Learning for Channel Estimation and Signal Detection in OFDM Systems\DNN_Detection\Train.pyc

    .......      7486  2017-12-22 04:06  Power of Deep Learning for Channel Estimation and Signal Detection in OFDM Systems\DNN_Detection\utils.py

    .......      5220  2017-12-22 04:06  Power of Deep Learning for Channel Estimation and Signal Detection in OFDM Systems\DNN_Detection\utils.pyc

    .......       285  2017-12-22 04:06  Power of Deep Learning for Channel Estimation and Signal Detection in OFDM Systems\ReadMe.rst

     文件        287  2018-11-15 13:47  Power of Deep Learning for Channel Estimation and Signal Detection in OFDM Systems\网上说明.txt

     目录          0  2019-01-01 15:47  Power of Deep Learning for Channel Estimation and Signal Detection in OFDM Systems\DNN_Detection

     目录          0  2018-11-21 14:03  Power of Deep Learning for Channel Estimation and Signal Detection in OFDM Systems

----------- ---------  ---------- -----  ----

               112176                    20


评论

共有 条评论