@@ -546,6 +546,26 @@ def test_common_den(self):
546546 np .zeros ((3 , 5 , 6 )))
547547 np .testing .assert_array_almost_equal (den , denref )
548548
549+ def test_common_den_nonproper (self ):
550+ """ Test _common_den with order(num)>order(den) """
551+
552+ tf1 = TransferFunction (
553+ [[[1. , 2. , 3. ]], [[1. , 2. ]]],
554+ [[[1. , - 2. ]], [[1. , - 3. ]]])
555+ tf2 = TransferFunction (
556+ [[[1. , 2. ]], [[1. , 2. , 3. ]]],
557+ [[[1. , - 2. ]], [[1. , - 3. ]]])
558+
559+ common_den_ref = np .array ([[1. , - 5. , 6. ]])
560+
561+ np .testing .assert_raises (ValueError , tf1 ._common_den )
562+ np .testing .assert_raises (ValueError , tf2 ._common_den )
563+
564+ _ , den1 , _ = tf1 ._common_den (allow_nonproper = True )
565+ np .testing .assert_array_almost_equal (den1 , common_den_ref )
566+ _ , den2 , _ = tf2 ._common_den (allow_nonproper = True )
567+ np .testing .assert_array_almost_equal (den2 , common_den_ref )
568+
549569 @unittest .skipIf (not slycot_check (), "slycot not installed" )
550570 def test_pole_mimo (self ):
551571 """Test for correct MIMO poles."""
@@ -557,6 +577,14 @@ def test_pole_mimo(self):
557577
558578 np .testing .assert_array_almost_equal (p , [- 2. , - 2. , - 7. , - 3. , - 2. ])
559579
580+ # non proper transfer function
581+ sys2 = TransferFunction (
582+ [[[1. , 2. , 3. , 4. ], [1. ]], [[1. ], [1. ]]],
583+ [[[1. , 2. ], [1. , 3. ]], [[1. , 4. , 4. ], [1. , 9. , 14. ]]])
584+ p2 = sys2 .pole ()
585+
586+ np .testing .assert_array_almost_equal (p2 , [- 2. , - 2. , - 7. , - 3. , - 2. ])
587+
560588 def test_double_cancelling_poles_siso (self ):
561589
562590 H = TransferFunction ([1 , 1 ], [1 , 2 , 1 ])
0 commit comments