fixed bug in calculation of percent overshoot by sawyerbfuller · Pull Request #555 · python-control/python-control

Dear @sawyerbfuller, the solution could have problem with systems with initial condition different of zero. I want to contribute , but at the moment, I don't now how test the last version.

I maked this example, to explain:

import numpy as np
import control as ctrl
import matplotlib.pyplot as plt

A = [[0,1,0],[0,0,1],[-1,-2,-3]]
B = [[0],[0],[1]]
C = [1,0,0]
D = 0

sys=ctrl.ss(A,B,C,D)

t= np.linspace(0,20,1000)
t1,y1 =ctrl.step_response(sys,t,[-1,0,2])

plt.plot(t1,y1)
ctrl.step_info(sys)

new_overshoot = 100. * (y1.max() - sys.dcgain()) / sys.dcgain()
print('new_overshoot =', new_overshoot)

{'RiseTime': 2.616832783582626,
'SettlingTime': 9.555404558233526,
'SettlingMin': 0.8926922608222024,
'SettlingMax': 1.1446150537879327,
'Overshoot': 15.77739060863902,
'Undershoot': 0.0,
'Peak': 1.1446150537879327,
'PeakTime': 6.06629418012336,
'SteadyStateValue': 0.9886343506022361}

new_overshoot = 38.34913836051592