Added channel impulse response. Try shifting the one around in the response in channel.py, it's pretty cool
This commit is contained in:
parent
6666efee1b
commit
6f09910060
@ -1,12 +1,14 @@
|
|||||||
import numpy as np
|
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):
|
def sim(in_data):
|
||||||
out_data = np.ndarray((len(in_data), len(in_data[0])), dtype=np.csingle)
|
out_data = np.ndarray((len(in_data), len(in_data[0])), dtype=np.csingle)
|
||||||
|
|
||||||
for i in range(len(in_data)):
|
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
|
||||||
|
|
||||||
|
|
||||||
|
4
data.txt
4
data.txt
@ -1 +1,5 @@
|
|||||||
The quick brown fox jumped over the lazy dog.
|
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.
|
||||||
|
6
main.py
6
main.py
@ -54,11 +54,13 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
ofdm_time = np.fft.ifft(modulated)
|
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
|
# 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)
|
to_decode = np.fft.fft(ofdm_cp_removed)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user