The present code is a Matlab function that provides a measurement of the transient time of a signal (not explicitly of a system!) – the time required for the signal envelope to reach and stay within a range of certain percentage (usually 2 %) of the final steady-state value. The measurement is based on: (i) extraction of the signal envelope; (ii) calculation of the deviation between the overall envelope and the final value of the envelope, where one assumes that the signal is already steady state; (iii) determination of the tolerance bounds (e.g., 2 %); (iv) determination of the time location where the deviation gets smaller than the tolerance.
An example is given in order to clarify the usage of the function. For convenience, the input and output arguments are given in the beginning of the function.
The code is based on the theory described in:
 K. Seeler. System Dynamics: An Introduction for Mechanical Engineers. New York, Springer, 2014.