diff options
author | Marius Peter <blendoit@gmail.com> | 2019-07-03 22:10:22 -0700 |
---|---|---|
committer | Marius Peter <blendoit@gmail.com> | 2019-07-03 22:10:22 -0700 |
commit | 9060d5a3d1f4d247b376894dea64aa694d9e98a6 (patch) | |
tree | e136608e4495086ba55a4a6edd878710d53cd425 /hw1 | |
parent | 22d52d09fcd15d38b47e795071a8ec4b4741e690 (diff) |
homework submission
Diffstat (limited to 'hw1')
-rw-r--r-- | hw1/code_2.PNG | bin | 0 -> 64908 bytes | |||
-rw-r--r-- | hw1/code_5.PNG | bin | 0 -> 27697 bytes | |||
-rw-r--r-- | hw1/plot_2-a.png | bin | 0 -> 32735 bytes | |||
-rw-r--r-- | hw1/plot_5.png | bin | 0 -> 22644 bytes | |||
-rw-r--r-- | hw1/prob_2.py | 30 | ||||
-rw-r--r-- | hw1/prob_5.py | 11 |
6 files changed, 41 insertions, 0 deletions
diff --git a/hw1/code_2.PNG b/hw1/code_2.PNG Binary files differnew file mode 100644 index 0000000..a6a2dbf --- /dev/null +++ b/hw1/code_2.PNG diff --git a/hw1/code_5.PNG b/hw1/code_5.PNG Binary files differnew file mode 100644 index 0000000..45dbd56 --- /dev/null +++ b/hw1/code_5.PNG diff --git a/hw1/plot_2-a.png b/hw1/plot_2-a.png Binary files differnew file mode 100644 index 0000000..c33d758 --- /dev/null +++ b/hw1/plot_2-a.png diff --git a/hw1/plot_5.png b/hw1/plot_5.png Binary files differnew file mode 100644 index 0000000..cacb3ab --- /dev/null +++ b/hw1/plot_5.png 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() |