Skip to content

Commit 18976c1

Browse files
authored
Merge pull request #647 from vincentchoqueuse/fix_damp_bug_dlti_system
fix damp method for discrete time systems with a negative real-valued pole
2 parents 6b7a9c7 + 140ca08 commit 18976c1

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

control/lti.py

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

161161
if isdtime(self, strict=True):
162-
splane_poles = np.log(poles)/self.dt
162+
splane_poles = np.log(poles.astype(complex))/self.dt
163163
else:
164164
splane_poles = poles
165165
wn = absolute(splane_poles)

control/tests/lti_test.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ 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 zeta.
74+
p2_zplane = -0.2
75+
sys_dt2 = tf(1, [1, -p2_zplane], dt)
76+
wn2, zeta2, p2 = sys_dt2.damp()
77+
p2_splane = -wn2 * zeta2 + 1j * wn2 * np.sqrt(1 - zeta2**2)
78+
p2_zplane = np.exp(p2_splane * dt)
79+
np.testing.assert_almost_equal(p2, p2_zplane)
80+
7381
def test_dcgain(self):
7482
sys = tf(84, [1, 2])
7583
np.testing.assert_allclose(sys.dcgain(), 42)

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