Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions control/tests/timeresp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,17 +301,17 @@ def mimo_ss_step_matlab(self):
'SteadyStateValue': -0.5394},
{'RiseTime': 0.0000, # (*)
'SettlingTime': 3.4000,
'SettlingMin': -0.1034,
'SettlingMin': -0.4350, # (*)
'SettlingMax': -0.1485,
'Overshoot': 132.0170,
'Undershoot': 79.222, # 0. in MATLAB
'Undershoot': 0.,
'Peak': 0.4350,
'PeakTime': .2,
'SteadyStateValue': -0.1875}]]
# (*): MATLAB gives 0.4 here, but it is unclear what
# 10% and 90% of the steady state response mean, when
# the step for this channel does not start a 0 for
# 0 initial conditions
# (*): MATLAB gives 0.4 for RiseTime and -0.1034 for
# SettlingMin, but it is unclear what 10% and 90% of
# the steady state response mean, when the step for
# this channel does not start a 0.
return T

@pytest.fixture
Expand Down
10 changes: 5 additions & 5 deletions control/timeresp.py
Original file line number Diff line number Diff line change
Expand Up @@ -923,11 +923,11 @@ def step_info(sysdata, T=None, T_num=None, yfinal=None,
else:
overshoot = 0

# Undershoot
y_us = (sgnInf * yout).min()
dy_us = np.abs(y_us)
if dy_us > 0:
undershoot = np.abs(100. * dy_us / InfValue)
# Undershoot : InfValue and undershoot must have opposite sign
y_us_index = (sgnInf * yout).argmin()
y_us = yout[y_us_index]
if (sgnInf * y_us) < 0:
undershoot = (-100. * y_us / InfValue)
else:
undershoot = 0

Expand Down