# this is the template for Lab #3, Task #4 import matplotlib.pyplot as p import math,numpy,random import lab3 def receive(samples,samples_per_bit=4,vth=0.5): """ Apply a statistical measure to samples to determine which sample in the bit cell should be used to determine the transmitted message bit. vth is the digitization threshold. Return a sequence or array of received message bits. """ pass # your code here def bit_error_rate(seq1,seq2): """ Perform a bit-by-bit comparison of two message sequences, returning the fraction of mismatches. """ pass # your code here if __name__ == '__main__': message = [random.randint(0,1) for i in xrange(1000000)] noisy_data = lab3.transmit(message,samples_per_bit=4,nmag=1.0) received_message = receive(noisy_data) ber = bit_error_rate(message,received_message) print "bit error rate = %g" % ber