handle empty pole vector for timevector calculation · python-control/python-control@1603e85
@@ -846,8 +846,8 @@ def _ideal_tfinal_and_dt(sys, is_step=True):
846846 The system whose time response is to be computed
847847 is_step : bool
848848 Scales the dc value by the magnitude of the nonzero mode since
849- integrating the impulse response gives
850- :math:`\int e^{-\lambda t} = -e^{-\lambda t}/ \lambda`
849+ integrating the impulse response gives
850+ :math:`\\int e^{-\\lambda t} = -e^{-\\lambda t}/ \\lambda`
851851 Default is True.
852852853853 Returns
@@ -900,8 +900,10 @@ def _ideal_tfinal_and_dt(sys, is_step=True):
900900p_u, p = p[m_u], p[~m_u]
901901if p_u.size > 0:
902902m_u = (p_u.real < 0) & (np.abs(p_u.imag) < sqrt_eps)
903-t_emp = np.max(log_decay_percent / np.abs(np.log(p_u[~m_u])/dt))
904-tfinal = max(tfinal, t_emp)
903+if np.any(~m_u):
904+t_emp = np.max(
905+log_decay_percent / np.abs(np.log(p_u[~m_u]) / dt))
906+tfinal = max(tfinal, t_emp)
905907906908# zero - negligible effect on tfinal
907909m_z = np.abs(p) < sqrt_eps