control.impulse_response
- control.impulse_response(sysdata, timepts=None, input_indices=None, output_indices=None, timepts_num=None, transpose=False, return_states=False, squeeze=None, **kwargs)[source]
Compute the impulse response for a linear system.
If the system has multiple inputs and/or multiple outputs, the impulse 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 valuesT
,yout
, see Time series data conventions.- Parameters
- sysdataI/O system or list of I/O systems
I/O system(s) for which impulse response is computed.
- timepts (or T)array_like or float, optional
Time vector, or simulation time duration if a scalar (time vector is auto-computed if not given; see
step_response
for more detail).- input_indices (or input)int, optional
Only compute the impulse response for the listed input. If not specified, the impulse responses for each independent input are computed.
- output_indices (or output)int, optional
Only report the step response for the listed output. If not specified, all outputs are reported.
- 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. Ifsqueeze
= False, keep the output as a 2D array (indexed by the output number and time) even if the system is SISO. The default value can be set usingconfig.defaults['control.squeeze_time_response']
.
- Returns
- results
TimeResponseData
orTimeResponseList
Time response represented as a
TimeResponseData
object or list ofTimeResponseData
objects. Seeforced_response
for additional information.
- results
See also
Notes
This function uses the
forced_response
function to compute the time response. For continuous-time systems, the initial condition is altered to account for the initial impulse. For discrete-time systems, the impulse is sized so that it has unit area. The impulse response for nonlinear systems is not implemented.Examples
>>> G = ct.rss(4) >>> T, yout = ct.impulse_response(G)