diff options
Diffstat (limited to 'hw4')
-rw-r--r-- | hw4/prob_1.py | 11 | ||||
-rw-r--r-- | hw4/prob_2.py | 8 | ||||
-rw-r--r-- | hw4/prob_5.py | 11 |
3 files changed, 30 insertions, 0 deletions
diff --git a/hw4/prob_1.py b/hw4/prob_1.py new file mode 100644 index 0000000..92e8af6 --- /dev/null +++ b/hw4/prob_1.py @@ -0,0 +1,11 @@ +import numpy as np +import control +import matplotlib.pyplot as plt + +# L = control.TransferFunction((1), (1, 6, 5, 0, 0)) +# L = control.TransferFunction((1, 2), (1, 10, 0, 0)) +L = control.TransferFunction((1, 1), (1, -3, 0)) + +rlist, klist = control.rlocus(L, kvect=np.linspace(100, -100, num=1000)) + +plt.show() diff --git a/hw4/prob_2.py b/hw4/prob_2.py new file mode 100644 index 0000000..c53cddf --- /dev/null +++ b/hw4/prob_2.py @@ -0,0 +1,8 @@ +import numpy as np +from math import exp, cos, sin +import matplotlib.pyplot as plt + +t = [0.01 * x for x in range(500)] +y = [1.0015 - 1.0404 * exp(-0.432 * t) + 0.039 * exp(-11.5567 * t) for t in t] +plt.plot(t, y) +plt.show() diff --git a/hw4/prob_5.py b/hw4/prob_5.py new file mode 100644 index 0000000..94d0fa5 --- /dev/null +++ b/hw4/prob_5.py @@ -0,0 +1,11 @@ +from scipy import signal +import matplotlib.pyplot as plt + +s1 = signal.lti([1, 2], [1, 4, 4, 6, 0]) +w, mag, phase = signal.bode(s1) + +plt.figure() +plt.semilogx(w, mag) +plt.figure() +plt.semilogx(w, phase) +plt.show() |