From 6f099100601c53537556d91efd53616b1e741ac7 Mon Sep 17 00:00:00 2001 From: David Lenfesty Date: Sun, 25 Aug 2019 18:29:24 -0600 Subject: [PATCH] Added channel impulse response. Try shifting the one around in the response in channel.py, it's pretty cool --- channel.py | 8 +++++--- data.txt | 4 ++++ main.py | 6 ++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/channel.py b/channel.py index 32ef5c4..562d1b0 100644 --- a/channel.py +++ b/channel.py @@ -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 diff --git a/data.txt b/data.txt index c953ffa..651caf2 100644 --- a/data.txt +++ b/data.txt @@ -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. diff --git a/main.py b/main.py index 2371ed4..0a2f56a 100755 --- a/main.py +++ b/main.py @@ -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)