summaryrefslogtreecommitdiff
path: root/hw1/prob_2.py
diff options
context:
space:
mode:
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