diff options
Diffstat (limited to 'sample_notebooks/DeepTrambadia/DeepTrambadia_version_backup/sc201.ipynb')
-rwxr-xr-x | sample_notebooks/DeepTrambadia/DeepTrambadia_version_backup/sc201.ipynb | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/sample_notebooks/DeepTrambadia/DeepTrambadia_version_backup/sc201.ipynb b/sample_notebooks/DeepTrambadia/DeepTrambadia_version_backup/sc201.ipynb new file mode 100755 index 00000000..b76b0ff0 --- /dev/null +++ b/sample_notebooks/DeepTrambadia/DeepTrambadia_version_backup/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 |