Thanks to the comment of @LutzLehmann, I’ve being thinking on the meaning of “encode twice” some stuff. So, back to square one, I realized that this transfer function incorporates both input (time or ramp) and initial conditions. It is actually an output. I need some sort of inverse laplace transform or, as I start to think, I’d need only to simulate it as it is, without further information.
Therefore, I managed to use an impulse input (which laplace transform is equal to 1) and I was able to get an output that was exactly my tf simulated in time.
import numpy as np
import control as ctl
import matplotlib.pyplot as plt
t = np.linspace(0., 1.5, 100)
sys = ctl.tf([1.,-4.],[1.,-4.,13.])
T, yout = ctl.impulse_response(sys, T=t) # HERE is what I wanted
y_ans = lambda x: 1/3*np.exp(2*x)*(3*np.cos(3*x) - 2*np.sin(3*x))
plt.plot(t, y_ans(t), '-.', color='gray', alpha=0.5, linewidth=3, label='correct answer')
plt.plot(T, yout, 'r', label='simulated')
plt.legend()
Now I think I can show how to use python-control to indirectly simulate answers for differential equations. 😀
CLICK HERE to find out more related problems solutions.