@@ -43,7 +43,7 @@ def tsystem(self, request):
4343 siso_ss1 .ystep = np .array ([9. , 17.6457 , 24.7072 , 30.4855 , 35.2234 ,
4444 39.1165 , 42.3227 , 44.9694 , 47.1599 ,
4545 48.9776 ])
46- # X0 = [0.5, 1]
46+ siso_ss1 . X0 = np . array ([[ .5 ], [ 1. ]])
4747 siso_ss1 .yinitial = np .array ([11. , 8.1494 , 5.9361 , 4.2258 , 2.9118 ,
4848 1.9092 , 1.1508 , 0.5833 , 0.1645 , - 0.1391 ])
4949 ss1 = siso_ss1 .sys
@@ -587,17 +587,23 @@ def test_forced_response_step(self, tsystem):
587587 [np .zeros ((10 ,), dtype = float ),
588588 0 ] # special algorithm
589589 )
590- @pytest .mark .parametrize ("tsystem" , ["siso_ss1" ], indirect = True )
590+ @pytest .mark .parametrize ("tsystem" , ["siso_ss1" , "siso_tf2" ],
591+ indirect = True )
591592 def test_forced_response_initial (self , tsystem , u ):
592- """Test forced response of SISO system as intitial response"""
593+ """Test forced response of SISO system as intitial response. """
593594 sys = tsystem .sys
594595 t = tsystem .t
595- x0 = np . array ([[ .5 ], [ 1. ]])
596+ x0 = tsystem . X0
596597 yref = tsystem .yinitial
597598
598- tout , yout = forced_response (sys , t , u , X0 = x0 )
599- np .testing .assert_array_almost_equal (tout , t )
600- np .testing .assert_array_almost_equal (yout , yref , decimal = 4 )
599+ if isinstance (sys , StateSpace ):
600+ tout , yout = forced_response (sys , t , u , X0 = x0 )
601+ np .testing .assert_array_almost_equal (tout , t )
602+ np .testing .assert_array_almost_equal (yout , yref , decimal = 4 )
603+ else :
604+ with pytest .warns (UserWarning , match = "Non-zero initial condition "
605+ "given for transfer function" ):
606+ tout , yout = forced_response (sys , t , u , X0 = x0 )
601607
602608 @pytest .mark .parametrize ("tsystem, useT" ,
603609 [("mimo_ss1" , True ),
0 commit comments