summaryrefslogtreecommitdiff
path: root/sample_notebooks/DeepTrambadia/sc201.ipynb
diff options
context:
space:
mode:
authorThomas Stephen Lee2015-08-28 16:53:23 +0530
committerThomas Stephen Lee2015-08-28 16:53:23 +0530
commit4a1f703f1c1808d390ebf80e80659fe161f69fab (patch)
tree31b43ae8895599f2d13cf19395d84164463615d9 /sample_notebooks/DeepTrambadia/sc201.ipynb
parent9d260e6fae7328d816a514130b691fbd0e9ef81d (diff)
downloadPython-Textbook-Companions-4a1f703f1c1808d390ebf80e80659fe161f69fab.tar.gz
Python-Textbook-Companions-4a1f703f1c1808d390ebf80e80659fe161f69fab.tar.bz2
Python-Textbook-Companions-4a1f703f1c1808d390ebf80e80659fe161f69fab.zip
add books
Diffstat (limited to 'sample_notebooks/DeepTrambadia/sc201.ipynb')
-rw-r--r--sample_notebooks/DeepTrambadia/sc201.ipynb53
1 files changed, 53 insertions, 0 deletions
diff --git a/sample_notebooks/DeepTrambadia/sc201.ipynb b/sample_notebooks/DeepTrambadia/sc201.ipynb
new file mode 100644
index 00000000..b76b0ff0
--- /dev/null
+++ b/sample_notebooks/DeepTrambadia/sc201.ipynb
@@ -0,0 +1,53 @@
+import math
+
+#(a)
+#initialisation of variables
+
+E=10 #E in V
+R=1 #R in Kohm
+
+
+#Calculations
+
+Id=E/R #Eq.(2.2)
+Vd=E
+print "The current Ic is= %fmA "%(Id),";Vd=0V"
+print "The diode voltage is= %fV"%(Vd),";Id=0A"
+print "The resulting load line appears in Fig. 2.4. The intersection between the load line and the characteristic curve defines the Q-point as"
+print "The level of VD is certainly an estimate, and the accuracy of ID is limited by the chosenscale. A higher degree of accuracy would require a plot that would be much large and perhaps unwieldy"
+
+
+#(B)
+print "(B)"
+Ir=9.25 #Ir in mA
+Vdq=0.78 #Vdq in v
+Vr=Ir*R
+print "Vr = Ir*R = Idq*R %d="%(Vr),"or"
+Vr = E-Vdq
+print "Vr = E-Vdq = %f" %(Vr)
+print "The difference in results is due to the accuracy with which the graph can be read. Ideally,the results obtained either way should be the same."
+
+#Graph solution to example 2.1
+
+import numpy as np
+import matplotlib.pyplot as plt
+
+Vd = np.linspace(0.0,10.0)
+Id = np.linspace(0.0,10.0)
+Id= -Vd + 10
+plt.plot(Vd, Id)
+Vd = [0,0,0.1,0.1,0.2,0.2,0.3,0.3,0.3,0.3,0.4,0.5,0.6,0.7]
+Id = [0,0,0,0,0,0,0,0,0.1,0.1,0.3,0.7,2.0,10.0]
+
+plt.plot(Vd, Id,'yo-')
+
+plt.xlabel('Voltage (v)')
+plt.ylabel('current (mA)')
+plt.title('About as simple as it gets, folks')
+plt.grid(True)
+plt.savefig("test.png")
+
+plt.show()
+
+print "example 2.2:"
+print "repeat the example 2.1 for R =2" \ No newline at end of file