@@ -449,7 +449,7 @@ def test_evalfr_mimo(self):
449
449
np .testing .assert_array_almost_equal (sys (2.j ), resp )
450
450
451
451
def test_freqresp_siso (self ):
452
- """Evaluate the magnitude and phase of a SISO system at
452
+ """Evaluate the magnitude and phase of a SISO system at
453
453
multiple frequencies."""
454
454
455
455
sys = TransferFunction ([1. , 3. , 5 ], [1. , 6. , 2. , - 1 ])
@@ -467,7 +467,7 @@ def test_freqresp_siso(self):
467
467
468
468
@unittest .skipIf (not slycot_check (), "slycot not installed" )
469
469
def test_freqresp_mimo (self ):
470
- """Evaluate the magnitude and phase of a MIMO system at
470
+ """Evaluate the magnitude and phase of a MIMO system at
471
471
multiple frequencies."""
472
472
473
473
num = [[[1. , 2. ], [0. , 3. ], [2. , - 1. ]],
@@ -547,6 +547,7 @@ def test_common_den(self):
547
547
np .zeros ((3 , 5 , 6 )))
548
548
np .testing .assert_array_almost_equal (den , denref )
549
549
550
+ @unittest .skipIf (not slycot_check (), "slycot not installed" )
550
551
def test_pole_mimo (self ):
551
552
"""Test for correct MIMO poles."""
552
553
@@ -804,6 +805,28 @@ def test_size_mismatch(self):
804
805
self .assertRaises (NotImplementedError ,
805
806
TransferFunction .feedback , sys2 , sys1 )
806
807
808
+ def test_latex_repr (self ):
809
+ """ Test latex printout for TransferFunction """
810
+ Hc = TransferFunction ([1e-5 , 2e5 , 3e-4 ],
811
+ [1.2e34 , 2.3e-4 , 2.3e-45 ])
812
+ Hd = TransferFunction ([1e-5 , 2e5 , 3e-4 ],
813
+ [1.2e34 , 2.3e-4 , 2.3e-45 ],
814
+ .1 )
815
+ # TODO: make the multiplication sign configurable
816
+ expmul = r'\times'
817
+ for var , H , suffix in zip (['s' , 'z' ],
818
+ [Hc , Hd ],
819
+ ['' , r'\quad dt = 0.1' ]):
820
+ ref = (r'$$\frac{'
821
+ r'1 ' + expmul + ' 10^{-5} ' + var + '^2 '
822
+ r'+ 2 ' + expmul + ' 10^{5} ' + var + ' + 0.0003'
823
+ r'}{'
824
+ r'1.2 ' + expmul + ' 10^{34} ' + var + '^2 '
825
+ r'+ 0.00023 ' + var + ' '
826
+ r'+ 2.3 ' + expmul + ' 10^{-45}'
827
+ r'}' + suffix + '$$' )
828
+ self .assertEqual (H ._repr_latex_ (), ref )
829
+
807
830
808
831
def suite ():
809
832
return unittest .TestLoader ().loadTestsFromTestCase (TestXferFcn )
0 commit comments