Added channel impulse response. Try shifting the one around in the response in channel.py, it's pretty cool

This commit is contained in:
David Lenfesty 2019-08-25 18:29:24 -06:00
parent 6666efee1b
commit 6f09910060
3 changed files with 13 additions and 5 deletions

View File

@ -1,12 +1,14 @@
import numpy as np
channel_response = np.array([1, 0, 1 - 1j])
channel_response = np.array([0, 0, 0, 1, 0, 0, 0])
def sim(in_data):
out_data = np.ndarray((len(in_data), len(in_data[0])), dtype=np.csingle)
for i in range(len(in_data)):
convolved = np.convolve(channel_response, in_data[i])
convolved = np.convolve(channel_response, in_data[i], mode='same')
out_data[i] = convolved
return out_data

View File

@ -1 +1,5 @@
The quick brown fox jumped over the lazy dog.
I can transmit arbitrary data as it stands, and it gets correctly decoded,
obviously assuming there is no error. Adding and then correcting for that error
is my next step.

View File

@ -54,11 +54,13 @@ if __name__ == '__main__':
ofdm_time = np.fft.ifft(modulated)
ofdm_prefixed = cp_add(ofdm_time, 4)
tx = cp_add(ofdm_time, 4)
rx = channel.sim(tx)
# Put the channel simulator stuff here
ofdm_cp_removed = cp_remove(ofdm_prefixed, 4)
ofdm_cp_removed = cp_remove(rx, 4)
to_decode = np.fft.fft(ofdm_cp_removed)