I am a beginner and I want to implement a demodulate function that takes in a signal (the received waveform), the number of bits per chunk k, and the length T in seconds of each signal (which is also the fundamental period), and returns the original bitstream.
def int_to_bitstring(n, k): n_binary = bin(n) n_binary = n_binary[2:] # bin prepends a 0b, which we don't want return n_binary.zfill(k) # prepend with zeros to k bits def demodulate(signal, k, T): """ Returns the demodulated version of signal using an Orthogonal Signaling scheme with k bits per chunk and T second signals. The return value will be the recovered bitstring. Parameters: signal - The received signal. k - The number of bits per chunk. You may assume len(bits) % k == 0, if bits is the original message. T - The duration, in seconds, of each individual modulated chunk. """ ```