Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion control/statesp.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,11 @@ def zero(self):
out = ab08nd(self.A.shape[0], self.B.shape[1], self.C.shape[0],
self.A, self.B, self.C, self.D)
nu = out[0]
return sp.linalg.eigvals(out[8][0:nu,0:nu], out[9][0:nu,0:nu])
if nu == 0:
return np.array([])
else:
return sp.linalg.eigvals(out[8][0:nu,0:nu], out[9][0:nu,0:nu])

except ImportError: # Slycot unavailable. Fall back to scipy.
if self.C.shape[0] != self.D.shape[1]:
raise NotImplementedError("StateSpace.zero only supports "
Expand Down
5 changes: 5 additions & 0 deletions control/tests/statesp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ def testPole(self):

np.testing.assert_array_almost_equal(p, true_p)

def testEmptyZero(self):
"""Test to make sure zero() works with no zeros in system"""
sys = _convertToStateSpace(TransferFunction([1], [1,2,1]))
np.testing.assert_array_equal(sys.zero(), np.array([]))

@unittest.skipIf(not slycot_check(), "slycot not installed")
def testMIMOZero_nonsquare(self):
"""Evaluate the zeros of a MIMO system."""
Expand Down