control.step_response

control.step_response(sysdata, timepts=None, initial_state=0.0, input_indices=None, output_indices=None, timepts_num=None, transpose=False, return_states=False, squeeze=None, params=None, **kwargs)[source]

Compute the step response for a linear system.

If the system has multiple inputs and/or multiple outputs, the step response is computed for each input/output pair, with all other inputs set to zero. Optionally, a single input and/or single output can be selected, in which case all other inputs are set to 0 and all other outputs are ignored.

For information on the shape of parameters T, X0 and return values T, yout, see Time series data conventions.

Parameters
sysdataI/O system or list of I/O systems

I/O system(s) for which step response is computed.

timepts (or T)array_like or float, optional

Time vector, or simulation time duration if a number. If T is not provided, an attempt is made to create it automatically from the dynamics of the system. If the system continuous time, the time increment dt is chosen small enough to show the fastest mode, and the simulation time period tfinal long enough to show the slowest mode, excluding poles at the origin and pole-zero cancellations. If this results in too many time steps (>5000), dt is reduced. If the system is discrete time, only tfinal is computed, and final is reduced if it requires too many simulation steps.

initial_state (or X0)array_like or float, optional

Initial condition (default = 0). This can be used for a nonlinear system where the origin is not an equilibrium point.

input_indices (or input)int or list of int, optional

Only compute the step response for the listed input. If not specified, the step responses for each independent input are computed (as separate traces).

output_indices (or output)int, optional

Only report the step response for the listed output. If not specified, all outputs are reported.

paramsdict, optional

If system is a nonlinear I/O system, set parameter values.

timepts_num (or T_num)int, optional

Number of time steps to use in simulation if T is not provided as an array (auto-computed if not given); ignored if the system is discrete time.

transposebool, optional

If True, transpose all input and output arrays (for backward compatibility with MATLAB and scipy.signal.lsim). Default value is False.

return_states (or return_x)bool, optional

If True, return the state vector when assigning to a tuple (default = False). See forced_response for more details.

squeezebool, optional

By default, if a system is single-input, single-output (SISO) then the output response is returned as a 1D array (indexed by time). If squeeze = True, remove single-dimensional entries from the shape of the output even if the system is not SISO. If squeeze = False, keep the output as a 3D array (indexed by the output, input, and time) even if the system is SISO. The default value can be set using config.defaults['control.squeeze_time_response'].

Returns
resultsTimeResponseData or TimeResponseList

Time response represented as a TimeResponseData object or list of TimeResponseData objects. See forced_response for additional information.

Notes

This function uses the forced_response function with the input set to a unit step.

Examples

>>> G = ct.rss(4)
>>> T, yout = ct.step_response(G)