def compare_subcarrier_location(alpha, M, K, overlap, oversampling_factor): import matplotlib.pyplot as plt import matplotlib.cm as cm goofy_ordering = False taps = gfdm_filter_taps('rrc', alpha, M, K, oversampling_factor) A0 = gfdm_modulation_matrix(taps, M, K, oversampling_factor, group_by_subcarrier=goofy_ordering) n = np.arange(M * K * oversampling_factor, dtype=np.complex) colors = iter(cm.rainbow(np.linspace(0, 1, K))) for k in range(K): color = next(colors) f = np.exp(1j * 2 * np.pi * (float(k) / (K * oversampling_factor)) * n) F = abs(np.fft.fft(f)) fm = np.argmax(F) / M plt.plot(F, '-.', label=k, color=color) data = get_zero_f_data(k, K, M) x0 = gfdm_gr_modulator(data, 'rrc', alpha, M, K, overlap, compat_mode=goofy_ordering) * (2. / K) f0 = 1. * np.argmax(abs(np.fft.fft(x0))) / M plt.plot(abs(np.fft.fft(x0)), label='FFT' + str(k), color=color) xA = A0.dot(get_data_matrix(data, K, group_by_subcarrier=goofy_ordering).flatten()) * (1. / K) fA = np.argmax(abs(np.fft.fft(xA))) / M plt.plot(abs(np.fft.fft(xA)), '-', label='matrix' + str(k), color=color) print fm, fA, f0 plt.legend() plt.show()
def validate_subcarrier_location(alpha, M, K, overlap, oversampling_factor): goofy_ordering = False taps = gfdm_filter_taps('rrc', alpha, M, K, oversampling_factor) A0 = gfdm_modulation_matrix(taps, M, K, oversampling_factor, group_by_subcarrier=goofy_ordering) n = np.arange(M * K * oversampling_factor, dtype=np.complex) for k in range(K): f = np.exp(1j * 2 * np.pi * (float(k) / (K * oversampling_factor)) * n) F = abs(np.fft.fft(f)) fm = 1. * np.argmax(F) / M data = get_zero_f_data(k, K, M) x0 = gfdm_gr_modulator( data, 'rrc', alpha, M, K, overlap, compat_mode=goofy_ordering) * (2. / K) f0 = 1. * np.argmax(abs(np.fft.fft(x0))) / M xA = A0.dot( get_data_matrix( data, K, group_by_subcarrier=goofy_ordering).flatten()) * (1. / K) fA = 1. * np.argmax(abs(np.fft.fft(xA))) / M if not fm == fA == f0: raise RuntimeError( 'ERROR: subcarriers are not located at the same bins!')
def compare_subcarrier_combination(): M = 8 K = 4 overlap = 2 data = get_zero_f_data(0, K, M) data += 2 * get_zero_f_data(3, K, M) print data F = get_data_matrix(data, K, False) print F F = np.reshape(np.tile(F.flatten(), overlap), (-1, K)) X0 = np.real(gfdm_combine_subcarriers_in_fd(F, M, K, overlap)) print X0 X = np.zeros(M * K, dtype=np.complex) for k in range(K): s = np.zeros(M * K, dtype=np.complex) s[0:M * overlap] = F[:, k] s = np.roll(s, k * M - M / 2) X += s print np.real(np.roll(X, -M / 2)) print np.all(np.roll(X, -M / 2) == X0) print np.all(X == X0) print np.real(X)
def validate_subcarrier_location(alpha, M, K, overlap, oversampling_factor): goofy_ordering = False taps = gfdm_filter_taps('rrc', alpha, M, K, oversampling_factor) A0 = gfdm_modulation_matrix(taps, M, K, oversampling_factor, group_by_subcarrier=goofy_ordering) n = np.arange(M * K * oversampling_factor, dtype=np.complex) for k in range(K): f = np.exp(1j * 2 * np.pi * (float(k) / (K * oversampling_factor)) * n) F = abs(np.fft.fft(f)) fm = 1. * np.argmax(F) / M data = get_zero_f_data(k, K, M) x0 = gfdm_gr_modulator(data, 'rrc', alpha, M, K, overlap, compat_mode=goofy_ordering) * (2. / K) f0 = 1. * np.argmax(abs(np.fft.fft(x0))) / M xA = A0.dot(get_data_matrix(data, K, group_by_subcarrier=goofy_ordering).flatten()) * (1. / K) fA = 1. * np.argmax(abs(np.fft.fft(xA))) / M if not fm == fA == f0: raise RuntimeError('ERROR: subcarriers are not located at the same bins!')