Skip to content

Commit 78b6fc2

Browse files
fix the return of the damp method for discrete time systems with a negative real-valued pole
1 parent 6b7a9c7 commit 78b6fc2

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

control/lti.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ def damp(self):
159159
poles = self.pole()
160160

161161
if isdtime(self, strict=True):
162+
poles = poles.astype(complex)
162163
splane_poles = np.log(poles)/self.dt
163164
else:
164165
splane_poles = poles

control/tests/lti_test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ def test_damp(self):
7070
np.testing.assert_almost_equal(sys_dt.damp(), expected_dt)
7171
np.testing.assert_almost_equal(damp(sys_dt), expected_dt)
7272

73+
#also check that for a discrete system with a negative real pole the damp function can extract wn and theta.
74+
p2_zplane = -0.2
75+
sys_dt2 = tf(1,[1,-p2_zplane],dt)
76+
wn2, zeta2, _ = sys_dt2.damp()
77+
p2 = -wn2 * zeta2 + 1j * wn2 * np.sqrt(1 - zeta2**2)
78+
p2_zplane = np.exp(p2*dt)
79+
np.testing.assert_almost_equal(sys_dt2.pole(),p2_zplane)
80+
81+
7382
def test_dcgain(self):
7483
sys = tf(84, [1, 2])
7584
np.testing.assert_allclose(sys.dcgain(), 42)

0 commit comments

Comments
 (0)