You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Scaling difference in impulse response size compared to scipy.signal #813
Originally posted by fhchl June 29, 2022
I had some code that I wanted to port from using scipy.signal.StateSpace etc. to python-control. There seems to be some scaling difference between the two implementations. What am I overlooking?
importnumpyasnpimportcontrolimportscipy.signal# random state space matricest=np.linspace(0, 10, dtype=float)
ss=control.drss(3, 2, 1)
A, B, C, D=ss.A, ss.B, ss.C, ss.Ddt=t[1]
# compute impulse response with python-controlss=control.ss(A, B, C, D, dt=dt)
t_control, h_control=control.impulse_response(ss, T=t)
plt.figure()
plt.plot(t_control, h_control[0, 0])
plt.plot(t_control, h_control[1, 0])
# compute impulse response with scipy.signalss_scipy=scipy.signal.StateSpace(A, B, C, D, dt=dt)
t_scipy, (h_scipy,) =scipy.signal.dimpulse(ss_scipy, t=t)
plt.figure()
plt.plot(t_scipy, h_scipy[:, 0])
plt.plot(t_scipy, h_scipy[:, 1])
plt.show()
Activity