MATLAB: How does the IMPULSE function select the time sample points to compute impulse response

Control System Toolbox

The documentation for the Control System Toolbox function IMPULSE states the following:
impulse(sys) plots the impulse response of an arbitrary LTI model sys. This model can be continuous or discrete, and SISO or MIMO. The impulse response of multi-input systems is the collection of impulse responses for each input channel. The duration of simulation is determined automatically to display the transient behavior of the response.
I would like to know how the duration of simulation is automatically determined. Specifically, I would like to know what the technique used to determine the system's settling time is.

Best Answer

The Control System Toolbox function IMPULSE determines the duration of the simulation based on the maximum deviation of the system's response from zero, since the impulse response typically settles at y=0. The current stopping criterion is based on y(t) becoming smaller than 0.01*(ymax-ymin) where ymax and ymin are the largest and smallest values of y(t) so far.
Note that there is no absolute guarantee that the response will not suddenly start increasing after initially settling. This being said, it is ensured the response stays inside the settling band for some time, which in most cases is enough to ensure that the response has indeed settled.
Related Question