Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Added singularity check to the residualization method
* Changed the unit test in matlab_test.py so that no error is thrown
  • Loading branch information
mp4096 committed Nov 20, 2016
commit 7b8c9f02c591106bf3c37a4b15f3d0976d7c9229
4 changes: 2 additions & 2 deletions control/modelsimp.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ def modred(sys, ELIM, method='matchdc'):
# if matchdc, residualize

# Check if the matrix A22 is invertible
# if np.linalg.matrix_rank(A22) != len(ELIM):
# raise ValueError("Matrix A22 is singular to working precision.")
if np.linalg.matrix_rank(A22) != len(ELIM):
raise ValueError("Matrix A22 is singular to working precision.")

# Now precompute A22\A21 and A22\B2 (A22I = inv(A22))
# We can solve two linear systems in one pass, since the
Expand Down
2 changes: 1 addition & 1 deletion control/tests/matlab_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ def testBalred(self):

def testModred(self):
modred(self.siso_ss1, [1])
modred(self.siso_ss2 * self.siso_ss3, [1, 2])
modred(self.siso_ss2 * self.siso_ss3, [0, 1])
modred(self.siso_ss3, [1], 'matchdc')
modred(self.siso_ss3, [1], 'truncate')

Expand Down