tf.double)

temp_Y = [[0] * symbol_num for i in range(4)]  # 임시 심볼 값을 담을 4xn 배열

# Matrix = [[0]*5 for i in range(7)]  열 행
# 인덱스로 접근해서 값 변경

for count in range(Count_Total):

    print(count)
    symbol = sym.Gensymbol(QAM, symbol_num)  # 초기 심볼
    data_s = de.Demode(QAM, symbol)  # 초기 심볼 위치 rsc err count

    for snr in range(SNR):

        symbol_y = sym.Addnoise(snr, symbol)  # 초기 심볼 + 노이즈
        # 초기화 부분
        position = np.zeros(symbol_num, int)  # 심볼의 사분면 위치를 담을 배열
        rsc_TakeCenter = [[0] * 4 for i in range(3)]

        # 계산을 위해 담음
        symbol_y = np.array(symbol_y)  # real imag 배열을 나누기 위해 array로 담음
        # symbol_real = tf.constant(symbol_y.real)
        # symbol_imag = tf.constant(symbol_y.imag)
        start = timeit.default_timer()
        with tf.device('/GPU:0'):
            temp_real = tf.pow(tf.subtract(symbol_y.real, init_center_real), 2)
            temp_imag = tf.pow(tf.subtract(symbol_y.imag, init_center_imag), 2)
            dist_temp = tf.sqrt(tf.add(temp_real, temp_imag))

        dist = dist_temp.numpy()
Esempio n. 2
0
for count in range(Count_Total):
    print(count)

    symbol = sym.Gensymbol(QAM, symbol_num)  # 초기 심볼 생성
    data_s = de.Demode(QAM, symbol)  # 초기 심볼 위치
    ch = sym.Gen_ch()  # 채널 생성
    symbol = sym.MultyCh(symbol, ch)  # 채널 입력

    for snr in range(SNR):
        if QAM == 4 or QAM == 16:
            tap = snr
        else:
            tab = snr * 2

        symbol_y = sym.Addnoise(tab, symbol)  # 초기 심볼 + 노이즈
        # 초기화 부분

        if QAM == 4:
            center, temp_Y = kc.Kmeans(Cluster, symbol_y, QAM, ch)
            est_ch, mse = est.Est_Ch(center, ch)
        else:
            center, temp_Y = kc.Kmeans_16QAM(Cluster, symbol_y, QAM, ch)
            hk_center = kc.Ch_Est_Center(center, QAM)
            est_ch, mse = est.Est_Ch(hk_center, ch)
        # print(snr)
        # print(ch)
        # print(est_ch)
        # print("------")
        symbol_r = sym.DividCh(symbol_y, est_ch)