Skip to content

Commit 1603e85

Browse files
committed
handle empty pole vector for timevector calculation
1 parent 51c797e commit 1603e85

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

control/timeresp.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
852852
853853
Returns
@@ -900,8 +900,10 @@ def _ideal_tfinal_and_dt(sys, is_step=True):
900900
p_u, p = p[m_u], p[~m_u]
901901
if p_u.size > 0:
902902
m_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)
905907

906908
# zero - negligible effect on tfinal
907909
m_z = np.abs(p) < sqrt_eps

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy