Skip to content

Commit 2c25b73

Browse files
committed
Added a unit test for residualization of unstable systems
1 parent bf6c446 commit 2c25b73

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

control/tests/modelsimp_test.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,18 @@ def testModredMatchDC(self):
5050
np.testing.assert_array_almost_equal(rsys.C, Crtrue,decimal=3)
5151
np.testing.assert_array_almost_equal(rsys.D, Drtrue,decimal=2)
5252

53+
def testModredUnstable(self):
54+
# Check if an error is thrown when an unstable system is given
55+
A = np.matrix('4.5418, 3.3999, 5.0342, 4.3808; \
56+
0.3890, 0.3599, 0.4195, 0.1760; \
57+
-4.2117, -3.2395, -4.6760, -4.2180; \
58+
0.0052, 0.0429, 0.0155, 0.2743')
59+
B = np.matrix('1.0, 1.0; 2.0, 2.0; 3.0, 3.0; 4.0, 4.0')
60+
C = np.matrix('1.0, 2.0, 3.0, 4.0; 1.0, 2.0, 3.0, 4.0')
61+
D = np.matrix('0.0, 0.0; 0.0, 0.0')
62+
sys = ss(A,B,C,D)
63+
np.testing.assert_raises(ValueError, modred, sys, [2, 3])
64+
5365
def testModredTruncate(self):
5466
#balanced realization computed in matlab for the transfer function:
5567
# num = [1 11 45 32], den = [1 15 60 200 60]

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