import numpy import matplotlib.pyplot as p import channel reload(channel) import lab1 reload(lab1) import lab2 reload(lab2) import lab2_2 reload(lab2_2) p.ion() # arguments: # usr -- numpy.array returned by unit_sample_response # mychannel -- instance of the channel.channel class # cname -- string used in plot title # samples_per_bit -- integer # return value: # none def compare_usr_chan(usr,mychannel,cname,samples_per_bit): """ Transmit the bit sequence [1,0,1,0,1,0,1,0] using "samples_per_bit" samples for each bit through the "mychannel", and then compare the results to the results generated using convolution with the "usr" (unit sample response). Generate a plot with three subplots: the samples received from the channel, the samples generated by convolution, and the difference between the two. Use the string "cname" for the title of the plot. """ pass # Your code here. if __name__ == '__main__': # plot the unit-sample response of our three virtual channels # Create the channels (noise free with no random delays # or padding) channel0 = channel.channel(channelid='0') channel1 = channel.channel(channelid='1') channel2 = channel.channel(channelid='2') samples_per_bit=8 compare_usr_chan(lab2_2.unit_sample_response(channel0),channel0, "channel 0", samples_per_bit) samples_per_bit=30 compare_usr_chan(lab2_2.unit_sample_response(channel1),channel1, "channel 1", samples_per_bit) samples_per_bit=20 compare_usr_chan(lab2_2.unit_sample_response(channel2),channel2, "channel 2", samples_per_bit) # when ready for checkoff, enable the following line #lab2.checkoff(compare_usr_chan,'L2_3')