Previous topic

scipy.signal.lsim

Next topic

scipy.signal.impulse

scipy.signal.lsim2

scipy.signal.lsim2(system, U=None, T=None, X0=None, **kwargs)[source]

Simulate output of a continuous-time linear system, by using the ODE solver scipy.integrate.odeint.

Parameters:

system : an instance of the lti class or a tuple describing the system.

The following gives the number of elements in the tuple and the interpretation:

  • 1: (instance of lti)
  • 2: (num, den)
  • 3: (zeros, poles, gain)
  • 4: (A, B, C, D)

U : array_like (1D or 2D), optional

An input array describing the input at each time T. Linear interpolation is used between given times. If there are multiple inputs, then each column of the rank-2 array represents an input. If U is not given, the input is assumed to be zero.

T : array_like (1D or 2D), optional

The time steps at which the input is defined and at which the output is desired. The default is 101 evenly spaced points on the interval [0,10.0].

X0 : array_like (1D), optional

The initial condition of the state vector. If X0 is not given, the initial conditions are assumed to be 0.

kwargs : dict

Additional keyword arguments are passed on to the function odeint. See the notes below for more details.

Returns:

T : 1D ndarray

The time values for the output.

yout : ndarray

The response of the system.

xout : ndarray

The time-evolution of the state-vector.

Notes

This function uses scipy.integrate.odeint to solve the system’s differential equations. Additional keyword arguments given to lsim2 are passed on to odeint. See the documentation for scipy.integrate.odeint for the full list of arguments.

If (num, den) is passed in for system, coefficients for both the numerator and denominator should be specified in descending exponent order (e.g. s^2 + 3s + 5 would be represented as [1, 3, 5]).