import sympy
import control as ct
import numpy as np
import matplotlib.pyplot as plt
A = np.asarray([
[0, 1],
[-5, -6]
])
B = np.asarray([
0,1
])
C = np.asarray([0, 1])
system = ct.ss2tf(A, B, C, 0)
system
answer_t = np.linspace(0, 7, 1000)
answer_fn = 0.25*np.exp(-answer_t) -0.25*np.exp(-5*answer_t)
t, y = ct.step_response(system)
plt.plot(t, y, color = 'blue')
plt.plot(answer_t, answer_fn, color = 'red')
plt.title('Step Response')
plt.xlabel('Time (seconds)')
plt.ylabel('Amplitude')
plt.grid(True)
plt.show()
answer_t = np.linspace(0, 7, 1000)
answer_fn = 0.25*np.exp(-answer_t) -0.25*np.exp(-5*answer_t)
plt.plot(answer_t, answer_fn, color = 'red')
plt.grid(True)
plt.show()
t, y = ct.step_response(system)
plt.plot(t, y, color = 'blue')
plt.grid(True)
plt.show()