Skip to content

Instantly share code, notes, and snippets.

@manashmandal
Last active August 13, 2016 19:21
Show Gist options
  • Save manashmandal/450bce6184d3602fbbb14d0032ca34b0 to your computer and use it in GitHub Desktop.
Save manashmandal/450bce6184d3602fbbb14d0032ca34b0 to your computer and use it in GitHub Desktop.
Communication Lab 04: AST and DST via Fiber Optic Link
import matplotlib.pyplot as plt
short_loss = [-44.49, -44.52, -44.99, -45.49, -46, -46.55,-47.16, -47.72, -48.92, -50.30, -52.04, -57.42]
short_freq = [1, 2.45, 2.73, 3.14, 3.57, 4.06, 4.43, 4.66, 5.19, 6.06, 7.99, 8.59]
long_loss = [-30.10, -30.45, -31.21, -32.64, -32.95, -33.98, -35.14, -36.12, -36.48, -38.06]
long_freq = [1.01, 1.55, 2.6, 3, 3.74, 3.83, 5.22, 5.96, 6.25, 7.35]
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.xaxis.set_ticks_position('top')
# plt.gca().invert_yaxis()
plt.plot(short_freq, short_loss, '-', linewidth=3, label='Short Cable')
plt.plot(long_freq, long_loss, '--', label='Long Cable', linewidth=4)
plt.xlabel('Frequency ' + r'$f(MHz)$')
ax.xaxis.tick_top()
plt.gca().set_ylim([min(short_loss), -20])
plt.ylabel('Loss ' + r'$dB$')
plt.show()
plt.plot(short_freq, short_voltage, '-', linewidth=3, label='Short Cable')
plt.plot(long_freq, long_voltage, '--', linewidth=4, label='Long Cable')
plt.xlabel('Frequency ' + r'$f(MHz)$')
plt.ylabel('Output Voltage (without gain) ' + r'$V_{0} \; (mV)$')
plt.legend(loc='best')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment