@@ -536,6 +536,32 @@ def test_discrete_time_impulse(self, tsystem):
536
536
sysdt = sys .sample (dt , 'impulse' )
537
537
np .testing .assert_array_almost_equal (impulse_response (sys , t )[1 ],
538
538
impulse_response (sysdt , t )[1 ])
539
+
540
+ def test_discrete_time_impulse_input (self ):
541
+ # discrete time impulse input, Only one active input for each trace
542
+ A = [[.5 , 0.25 ],[.0 , .5 ]]
543
+ B = [[1. , 0 ,],[0. , 1. ]]
544
+ C = [[1. , 0. ],[0. , 1. ]]
545
+ D = [[0. , 0. ],[0. , 0. ]]
546
+ dt = True
547
+ sysd = ct .ss (A ,B ,C ,D , dt = dt )
548
+ response = ct .impulse_response (sysd ,T = dt * 3 )
549
+
550
+ Uexpected = np .zeros ((2 ,2 ,4 ), dtype = float ).astype (object )
551
+ Uexpected [0 ,0 ,0 ] = 1. / dt
552
+ Uexpected [1 ,1 ,0 ] = 1. / dt
553
+
554
+ np .testing .assert_array_equal (response .inputs ,Uexpected )
555
+
556
+ dt = 0.5
557
+ sysd = ct .ss (A ,B ,C ,D , dt = dt )
558
+ response = ct .impulse_response (sysd ,T = dt * 3 )
559
+
560
+ Uexpected = np .zeros ((2 ,2 ,4 ), dtype = float ).astype (object )
561
+ Uexpected [0 ,0 ,0 ] = 1. / dt
562
+ Uexpected [1 ,1 ,0 ] = 1. / dt
563
+
564
+ np .testing .assert_array_equal (response .inputs ,Uexpected )
539
565
540
566
@pytest .mark .parametrize ("tsystem" , ["siso_ss1" ], indirect = True )
541
567
def test_impulse_response_warnD (self , tsystem ):
0 commit comments