diff --git a/control/tests/timeresp_test.py b/control/tests/timeresp_test.py index 5549b2a88..39bc533bf 100644 --- a/control/tests/timeresp_test.py +++ b/control/tests/timeresp_test.py @@ -204,6 +204,15 @@ def test_impulse_response(self): np.testing.assert_array_almost_equal( yy, np.vstack((youttrue, np.zeros_like(youttrue))), decimal=4) + def test_discrete_time_impulse(self): + # discrete time impulse sampled version should match cont time + dt = 0.1 + t = np.arange(0, 3, dt) + sys = self.siso_tf1 + sysdt = sys.sample(dt, 'impulse') + np.testing.assert_array_almost_equal(impulse_response(sys, t)[1], + impulse_response(sysdt, t)[1]) + def test_initial_response(self): # Test SISO system sys = self.siso_ss1 diff --git a/control/timeresp.py b/control/timeresp.py index 8670c180d..d6c31a89b 100644 --- a/control/timeresp.py +++ b/control/timeresp.py @@ -815,7 +815,7 @@ def impulse_response(sys, T=None, X0=0., input=0, output=None, T_num=None, new_X0 = B + X0 else: new_X0 = X0 - U[0] = 1. + U[0] = 1./sys.dt # unit area impulse T, yout, _xout = forced_response(sys, T, U, new_X0, transpose=transpose, squeeze=squeeze) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy