Last active
August 20, 2016 18:33
-
-
Save manashmandal/e950e29d7b3e90ea1a51feb196f4cb18 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# seq = ('name ', 'roll', 'class') | |
# keys = [1, 2, 3] | |
# dict1 = dict.fromkeys(seq, keys) | |
# print "%s" % dict1 | |
# -*- coding: utf-8 -*- | |
""" | |
Spyder Editor | |
This is a temporary script file. | |
""" | |
import matplotlib.pyplot as plt | |
short_loss = [-10,-10,-10,-10,-10,-10,-10.13788284,-10.28028724,-10.9017663,-10.81904104,-11.0720997,-11.24938737,-12.04119983,-12.74701057,-13.01029996,-13.59021943,-15.05149978,-18.06179974,-19.03089987,-22.04119983] | |
short_freq = [0.050,.100,.150,.200,.400,.500,.800,1,2.5,3.0,4.0,4.5,5,6,7,9,10,11,12,13] | |
long_loss = [-5.051499783,-5.051499783,-5.051499783,-5.051499783,-5.051499783,-5.051499783,-5.051499783,-5.051499783,-5.051499783,-5.051499783,-6.020599913,-6.600519383,-7.269987279,-7.269987279,-8.06179974,-10.28028724,-10.9017663,-11.24938737,-13.01029996,-13.59021943] | |
long_freq = short_freq | |
max_val = max(long_freq) | |
print max_val | |
electrical_bandwidth = max_val * .707 | |
optical_bandwidth = max_val * 0.5 | |
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=5, label='Short Cable', color="red") | |
plt.plot(long_freq, long_loss, '-', label='Long Cable', linewidth=6, color="blue") | |
plt.xlabel('Frequency ' + r'$f(MHz)$') | |
ax.xaxis.tick_top() | |
plt.gca().set_ylim([min(short_loss), -3]) | |
plt.ylabel('Loss ' + r'$dB$') | |
plt.show() | |
short_voltage=[0.04,0.04,0.04,0.04,0.04,0.04,0.03875,0.0375,0.0325,0.033125,0.03125,0.03,0.025,0.02125,0.02,0.0175,0.0125,0.00625,0.005,0.0025] | |
long_voltage=[0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.125,0.1,0.0875,0.075,0.075,0.0625,0.0375,0.0325,0.03,0.02,0.0175] | |
# plt.axvline(short_voltage[]) | |
plt.axvline(optical_bandwidth, label="Optical Bandwidth" + r'$\; B_{o}$', linewidth = 3, color="red") | |
plt.axvline(electrical_bandwidth, label="Electrical Bandwidth" + r'$\; B_{e}$', linewidth = 3, color="blue") | |
plt.plot(short_freq, short_voltage, '--', linewidth=5, label='Short Cable', color="red") | |
plt.plot(long_freq, long_voltage, '-', linewidth=6, label='Long Cable', color="blue") | |
plt.xlabel('Frequency ' + r'$f(MHz)$') | |
plt.ylabel('Output Voltage (without gain) ' + r'$V_{0} \; (V)$') | |
plt.legend(loc='best') | |
plt.show() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment