@@ -143,6 +143,31 @@ def testSSSS2(self, tsys):
143143 0.142857142857143 , - 0.571428571428571 , 0.857142857142857 ]])
144144 np .testing .assert_array_almost_equal (ans2 .D , [[- 0.285714285714286 ]])
145145
146+ def test_mimo_ss_scalar_feedback (self ):
147+ """MIMO state space system with scalar feedback block."""
148+ sys_static = StateSpace ([], [], [], [[1 , 0 ], [0 , 2 ]])
149+ ans1 = feedback (sys_static )
150+ ans2 = feedback (sys_static , np .eye (2 ))
151+ np .testing .assert_array_almost_equal (ans1 .D , ans2 .D )
152+
153+ ans3 = feedback (sys_static , 2 )
154+ ans4 = feedback (sys_static , 2 * np .eye (2 ))
155+ np .testing .assert_array_almost_equal (ans3 .D , ans4 .D )
156+
157+ sys_dynamic = StateSpace (
158+ [[- 1 , 0 ], [0 , - 2 ]], [[1 , 0 ], [0 , 1 ]],
159+ [[1 , 0 ], [0 , 1 ]], [[0 , 0 ], [0 , 0 ]])
160+ ans5 = feedback (sys_dynamic )
161+ ans6 = feedback (sys_dynamic , np .eye (2 ))
162+ np .testing .assert_array_almost_equal (ans5 .A , ans6 .A )
163+ np .testing .assert_array_almost_equal (ans5 .B , ans6 .B )
164+ np .testing .assert_array_almost_equal (ans5 .C , ans6 .C )
165+ np .testing .assert_array_almost_equal (ans5 .D , ans6 .D )
166+
167+ sys_nonsquare = StateSpace ([], [], [], [[1 , 2 , 3 ], [4 , 5 , 6 ]])
168+ with pytest .raises (ValueError , match = "compatible inputs/outputs" ):
169+ feedback (sys_nonsquare )
170+
146171
147172 def testSSTF (self , tsys ):
148173 """State space system with transfer function feedback block."""
0 commit comments