summaryrefslogtreecommitdiff
path: root/hw1/prob_2.py
diff options
context:
space:
mode:
authorMarius Peter <blendoit@gmail.com>2019-07-03 22:10:22 -0700
committerMarius Peter <blendoit@gmail.com>2019-07-03 22:10:22 -0700
commit9060d5a3d1f4d247b376894dea64aa694d9e98a6 (patch)
treee136608e4495086ba55a4a6edd878710d53cd425 /hw1/prob_2.py
parent22d52d09fcd15d38b47e795071a8ec4b4741e690 (diff)
homework submission
Diffstat (limited to 'hw1/prob_2.py')
-rw-r--r--hw1/prob_2.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/hw1/prob_2.py b/hw1/prob_2.py
new file mode 100644
index 0000000..20585c8
--- /dev/null
+++ b/hw1/prob_2.py
@@ -0,0 +1,30 @@
+import numpy as np
+import matplotlib.pyplot as plt
+from math import pi
+
+N = 300
+fr = np.logspace(-3, 3, N)
+w = 2 * pi * fr
+s = w * 1j
+
+R1 = 1e6
+R2 = 1e4
+C = 1.6e-6 / 2 / pi
+
+num = R1 * R2 * C * s + R2
+den = R1 * R2 * C * s + R1 + R2
+H = num / den
+
+plt.figure(1)
+plt.subplot(211)
+plt.loglog(fr, abs(H))
+plt.xlabel('Frequency (Hz)')
+plt.ylabel('Magnitude (V/V)')
+plt.title('R1 = 1MΩ, R2 = 1kΩ,C = 1.6μF, Rf = 100kΩ')
+
+plt.subplot(212)
+plt.semilogx(fr, np.angle(H) * 180 / pi)
+plt.xlabel('Frequency (Hz)')
+plt.ylabel('Phase (deg)')
+
+plt.show()
Copyright 2019--2024 Marius PETER