From 9060d5a3d1f4d247b376894dea64aa694d9e98a6 Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Wed, 3 Jul 2019 22:10:22 -0700 Subject: homework submission --- hw1/code_2.PNG | Bin 0 -> 64908 bytes hw1/code_5.PNG | Bin 0 -> 27697 bytes hw1/plot_2-a.png | Bin 0 -> 32735 bytes hw1/plot_5.png | Bin 0 -> 22644 bytes hw1/prob_2.py | 30 ++++++++++++++++++++++++++++++ hw1/prob_5.py | 11 +++++++++++ 6 files changed, 41 insertions(+) create mode 100644 hw1/code_2.PNG create mode 100644 hw1/code_5.PNG create mode 100644 hw1/plot_2-a.png create mode 100644 hw1/plot_5.png create mode 100644 hw1/prob_2.py create mode 100644 hw1/prob_5.py diff --git a/hw1/code_2.PNG b/hw1/code_2.PNG new file mode 100644 index 0000000..a6a2dbf Binary files /dev/null and b/hw1/code_2.PNG differ diff --git a/hw1/code_5.PNG b/hw1/code_5.PNG new file mode 100644 index 0000000..45dbd56 Binary files /dev/null and b/hw1/code_5.PNG differ diff --git a/hw1/plot_2-a.png b/hw1/plot_2-a.png new file mode 100644 index 0000000..c33d758 Binary files /dev/null and b/hw1/plot_2-a.png differ diff --git a/hw1/plot_5.png b/hw1/plot_5.png new file mode 100644 index 0000000..cacb3ab Binary files /dev/null and b/hw1/plot_5.png differ 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() diff --git a/hw1/prob_5.py b/hw1/prob_5.py new file mode 100644 index 0000000..c3aa6d4 --- /dev/null +++ b/hw1/prob_5.py @@ -0,0 +1,11 @@ +import numpy as np +import matplotlib.pyplot as plt + +t = [0.01 * x for x in range(0, 1001)] +y = [-(t + 1) * np.exp(-t) for t in t] + +plt.plot(t, y) +plt.xlabel('t (sec)') +plt.ylabel('y(t)') +plt.title('MAE 171A - Homework 1.5\n Step Response') +plt.show() -- cgit v1.2.3