Skip to content

Commit

Permalink
BugFix: pole of stateless StateSpace object is empty array
Browse files Browse the repository at this point in the history
  • Loading branch information
roryyorke committed Dec 28, 2016
1 parent 09f9bab commit c84debb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion control/statesp.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ def freqresp(self, omega):
def pole(self):
"""Compute the poles of a state space system."""

return eigvals(self.A)
return eigvals(self.A) if self.states else np.array([])

def zero(self):
"""Compute the zeros of a state space system."""
Expand Down
6 changes: 6 additions & 0 deletions control/tests/statesp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,12 @@ def testPole(self):
self.assertTrue(abs(z) < 1)


def testPoleStatic(self):
"""Regression: pole() of static gain is empty array"""
np.testing.assert_array_equal(np.array([]),
StateSpace([],[],[],[[1]]).pole())


def suite():
return unittest.TestLoader().loadTestsFromTestCase(TestStateSpace)

Expand Down

0 comments on commit c84debb

Please sign in to comment.