def impulse(system, X0=None, T=None, N=None):
if isinstance(system, lti):<EOL><INDENT>sys = system<EOL><DEDENT>else:<EOL><INDENT>sys = lti(*system)<EOL><DEDENT>if X0 is None:<EOL><INDENT>B = sys.B<EOL><DEDENT>else:<EOL><INDENT>B = sys.B + X0<EOL><DEDENT>if N is None:<EOL><INDENT>N = <NUM_LIT:100><EOL><DEDENT>if T is None:<EOL><INDENT>T = _default_response_times(sys.A, N)<EOL><DEDENT>else:<EOL><INDENT>T = asarray(T)<EOL><DEDENT>h = zeros(T.shape, sys.A.dtype)<EOL>s, v = linalg.eig(sys.A)<EOL>vi = linalg.inv(v)<EOL>C = sys.C<EOL>for k in range(len(h)):<EOL><INDENT>es = diag(numpy.exp(s * T[k]))<EOL>eA = dot(dot(v, es), vi)<EOL>eA = _cast_to_array_dtype(eA, h)<EOL>h[k] = squeeze(dot(dot(C, eA), B))<EOL><DEDENT>return T, h<EOL>
Impulse response of continuous-time system.

    Parameters
    ----------
    system : an instance of the LTI class or a tuple of array_like
        describing the system.
        The following gives the number of elements in the tuple and
        the interpretation:

            * 2 (num, den)
            * 3 (zeros, poles, gain)
            * 4 (A, B, C, D)

    X0 : array_like, optional
        Initial state-vector.  Defaults to zero.
    T : array_like, optional
        Time points.  Computed if not given.
    N : int, optional
        The number of time points to compute (if `T` is not given).

    Returns
    -------
    T : ndarray
        A 1-D array of time points.
    yout : ndarray
        A 1-D array containing the impulse response of the system (except for
        singularities at zero).