Scaling difference in impulse response compared to scipy.signal #747
-
I had some code that I wanted to port from using import numpy as np
import control
import scipy.signal
# random state space matrices
t= np.linspace(0, 10, dtype=float)
ss = control.drss(3, 2, 1)
A, B, C, D = ss.A, ss.B, ss.C, ss.D
dt = t[1]
# compute impulse response with python-control
ss = 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.signal
ss_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() Creates these two here. |
Beta Was this translation helpful? Give feedback.
Answered by
bnavigator
Jun 29, 2022
Replies: 1 comment 2 replies
-
python-control computes the response to a unit area impulse, rather than a unit height impulse: #447 |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
fhchl
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
python-control computes the response to a unit area impulse, rather than a unit height impulse: #447