@@ -302,6 +302,13 @@ def forced_response(sys, T=None, U=0., X0=0., transpose=False,
302
302
"return_x specified for a transfer function system. Internal "
303
303
"conversion to state space used; results may meaningless." )
304
304
305
+ # If we are passed a transfer function and X0 is non-zero, warn the user
306
+ if isinstance (sys ,TransferFunction )and np .any (X0 != 0 ):
307
+ warnings .warn (
308
+ "Non-zero initial condition given for transfer function system. "
309
+ "Internal conversion to state space used; may not be consistent "
310
+ "with given X0." )
311
+
305
312
sys = _convert_to_statespace (sys )
306
313
A ,B ,C ,D = np .asarray (sys .A ),np .asarray (sys .B ),np .asarray (sys .C ), \
307
314
np .asarray (sys .D )
@@ -358,12 +365,6 @@ def forced_response(sys, T=None, U=0., X0=0., transpose=False,
358
365
X0 = _check_convert_array (X0 , [(n_states ,), (n_states ,1 )],
359
366
'Parameter ``X0``: ' ,squeeze = True )
360
367
361
- # If we are passed a transfer function and X0 is non-zero, warn the user
362
- if isinstance (sys ,TransferFunction )and np .any (X0 != 0 ):
363
- warnings .warn (
364
- "Non-zero initial condition given for transfer function system. "
365
- "Internal conversion to state space used; may not be consistent "
366
- "with given X0." )
367
368
368
369
xout = np .zeros ((n_states ,n_steps ))
369
370
xout [:,0 ]= X0