def impulse2(system, X0=None, T=None, N=None, **kwargs):
 if isinstance(system, lti):
  sys = system._as_ss()
 elif isinstance(system, dlti):
  raise AttributeError('impulse2 can only be used with continuous-time systems.')
 else:
  sys = lti(*system)._as_ss()
 B = sys.B
 if (B.shape[(-1)] != 1):
  raise ValueError('impulse2() requires a single-input system.')
 B = B.squeeze()
 if (X0 is None):
  X0 = zeros_like(B)
 if (N is None):
  N = 100
 if (T is None):
  T = _default_response_times(sys.A, N)
 ic = (B + X0)
 (Tr, Yr, Xr) = lsim2(sys, T=T, X0=ic, **kwargs)
 return (Tr, Yr)

def impulse2 ( system , X0 = None , T = None , N = None , ** kwargs ) : if isinstance ( system , lti ) : sys = system . _as_ss ( ) elif isinstance ( system , dlti ) : raise AttributeError ( 'impulse2 can only be used with continuous-time systems.' ) else : sys = lti ( * system ) . _as_ss ( ) B = sys . B if ( B . shape [ ( - 1 ) ] != 1 ) : raise ValueError ( 'impulse2() requires a single-input system.' ) B = B . squeeze ( ) if ( X0 is None ) : X0 = zeros_like ( B ) if ( N is None ) : N = 100 if ( T is None ) : T = _default_response_times ( sys . A , N ) ic = ( B + X0 ) ( Tr , Yr , Xr ) = lsim2 ( sys , T = T , X0 = ic , ** kwargs ) return ( Tr , Yr )
impulse response of a single-input .