From 047b83533fc84ea3e428a60533e4751ccf8495d3 Mon Sep 17 00:00:00 2001 From: David Lenfesty Date: Thu, 5 Sep 2019 11:12:38 -0600 Subject: [PATCH] More work. I have no idea why channel estimation isn't working. --- channel.py | 13 +------------ main.py | 5 +---- qam.py | 1 - 3 files changed, 2 insertions(+), 17 deletions(-) diff --git a/channel.py b/channel.py index b62e927..04c7b84 100644 --- a/channel.py +++ b/channel.py @@ -75,8 +75,6 @@ def estimate(in_data, pilots=0): pilot_carriers = all_carriers[::(len(all_carriers)) // pilots] pilot_carriers = np.delete(pilot_carriers, 0) - print(pilot_carriers) - # start averaging #H_est = 0 @@ -92,16 +90,7 @@ def estimate(in_data, pilots=0): # # Take angular form and turn into rectangular form # H_est += H_est_abs * np.exp(1j*H_est_phase) - H_est_pilots = np.ndarray((len(pilot_carriers)), dtype=np.csingle) - - j = 0 - # Obtain channel response at pilot carriers - for i in pilot_carriers: - H_est_pilots[j] = in_data[0][i] / pilot_value - print("Value: " + str(in_data[0][i])) - print("Pilot estimate: " + str(H_est_pilots[j])) - j += 1 - + H_est_pilots = in_data[0][pilot_carriers] / pilot_value # Interpolate estimates based on what we get from the few pilot values H_est_abs = scipy.interpolate.interp1d(pilot_carriers, abs(H_est_pilots), kind='linear', fill_value='extrapolate')(all_carriers) diff --git a/main.py b/main.py index abcd16b..1fc1906 100755 --- a/main.py +++ b/main.py @@ -5,6 +5,7 @@ Shitty OFDM simulator designed to make it so I understand OFDM. Hopefully eventually this modem design makes it onto an fpga. TODO: + FIX CHANNEL ESTIMATION Change channel estimation to pre-amble symbols Add comments for functions Add more errors, like a shifted signal @@ -90,10 +91,6 @@ if __name__ == '__main__': # Simulate effects of a multipath channel rx = channel.sim(tx) - plt.plot(rx[0], "b") - plt.plot(theoretical_rx, "r") - plt.show(block=True) - # Remove cyclic prefix from incoming symbols ofdm_cp_removed = cp_remove(rx, 16) diff --git a/qam.py b/qam.py index 827513f..7ce7a9b 100644 --- a/qam.py +++ b/qam.py @@ -36,7 +36,6 @@ def modulate(in_data, pilots=0): pilot_carriers = all_carriers[::(num_data_carriers + pilots)//pilots] pilot_carriers = np.delete(pilot_carriers, 0) # not sure how to not have this line data_carriers = np.delete(all_carriers, pilot_carriers) - print(pilot_carriers) else: data_carriers = all_carriers