More work.
I have no idea why channel estimation isn't working.
This commit is contained in:
parent
1e20a5c6be
commit
047b83533f
13
channel.py
13
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)
|
||||
|
5
main.py
5
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)
|
||||
|
||||
|
1
qam.py
1
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user