Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitef43d0a

Browse files
committed
Fix h2syn, added simple test
Similar fix to hinfsyn: np -> np_, and identical test.
1 parent9187645 commitef43d0a

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

‎control/robust.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ def h2syn(P,nmeas,ncon):
9090

9191
n=np.size(P.A,0)
9292
m=np.size(P.B,1)
93-
np=np.size(P.C,0)
94-
out=sb10hd(n,m,np,ncon,nmeas,P.A,P.B,P.C,P.D)
93+
np_=np.size(P.C,0)
94+
out=sb10hd(n,m,np_,ncon,nmeas,P.A,P.B,P.C,P.D)
9595
Ak=out[0]
9696
Bk=out[1]
9797
Ck=out[2]

‎control/tests/robust_test.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,21 @@ def testHinfsyn(self):
2626

2727
# TODO: add more interesting examples
2828

29+
classTestH2(unittest.TestCase):
30+
@unittest.skipIf(notslycot_check(),"slycot not installed")
31+
deftestH2syn(self):
32+
"Test h2syn"
33+
p=control.ss(-1, [1,1], [[1], [1]], [[0,1], [1,0]])
34+
k=control.robust.h2syn(p,1,1)
35+
# from Octave, which also uses SB10HD for H-2 synthesis:
36+
# a= -1; b1= 1; b2= 1; c1= 1; c2= 1; d11= 0; d12= 1; d21= 1; d22= 0;
37+
# g = ss(a,[b1,b2],[c1;c2],[d11,d12;d21,d22]);
38+
# k = h2syn(g,1,1);
39+
# the solution is the same as for the hinfsyn test
40+
np.testing.assert_array_almost_equal(k.A, [[-3]])
41+
np.testing.assert_array_almost_equal(k.B, [[1]])
42+
np.testing.assert_array_almost_equal(k.C, [[-1]])
43+
np.testing.assert_array_almost_equal(k.D, [[0]])
2944

3045
if__name__=="__main__":
3146
unittest.main()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp