# harold.simulate_linear_system¶

harold.simulate_linear_system(sys, u, t=None, x0=None, per_channel=False)

Compute the linear model response to an input array sampled at given time instances.

Parameters: sys ({State, Transfer}) – The system model to be simulated u (array_like) – The real-valued input sequence to force the model. 1D arrays for single input models and 2D arrays that has as many columns as the number of inputs are valid inputs. t (array_like, optional) – The real-valued sequence to be used for the evolution of the system. The values should be equally spaced otherwise an error is raised. For discrete time models increments different than the sampling period also raises an error. On the other hand for discrete models this can be omitted and a time sequence will be generated automatically. x0 (array_like, optional) – The initial condition array. If omitted an array of zeros is assumed. Note that Transfer models by definition assume zero initial conditions and will raise an error. per_channel (bool, optional) – If this is set to True and if the system has multiple inputs, the response of each input is returned individually. For example, if a system has 4 inputs and 3 outputs then the response shape becomes (num, p, m) instead of (num, p) where k-th slice (:, :, k) is the response from the k-th input channel. For single input systems, this keyword has no effect. yout (ndarray) – The resulting response array. The array is 1D if sys is SISO and has p columns if sys has p outputs. tout (ndarray) – The time sequence used in the simulation. If the parameter t is not None then a copy of t is given.

Notes

For Transfer models, first conversion to a state model is performed and then the resulting model is used for computations.