You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Result of the damp function for discrete time systems #646
The method damp() seems to return a wrong result for discrete systems with negative poles
import control as ctl
H = ctl.tf([1],[1,0.2],1)
H.damp()
Result : RuntimeWarning: invalid value encountered in log
Investigation
The problem seems to come from the type of the poles variable in the dampmethod of the LTI object
if isdtime(self, strict=True):
splane_poles = np.log(poles)/self.dt
else:
splane_poles = poles
wn = absolute(splane_poles)
Z = -real(splane_poles)/wn
return wn, Z, poles
Solution
The poles variable must be cast to a numpy complex type as follows
if isdtime(self, strict=True)
splane_poles = np.log(poles.astype(complex))/self.dt
...
Activity
bnavigator commentedon Aug 17, 2021
Hi,
thanks for catching this!
Awesome! Would you try to make the next step and create a Pull Request with your proposed changes?
Bonus points for adding your example to
test_damp()(usingpytest.mark.parametrize()) :python-control/control/tests/lti_test.py
Lines 54 to 71 in 6b7a9c7