@@ -492,6 +492,152 @@ def test_operator_conversion(self):
492492 with pytest .raises (TypeError ):
493493 FrequencyResponseData .__add__ (frd_tf , 'string' )
494494
495+ @pytest .mark .parametrize (
496+ "left, right, expected" ,
497+ [
498+ (
499+ TransferFunction ([2 ], [1 , 0 ]),
500+ TransferFunction (
501+ [
502+ [[2 ], [1 ]],
503+ [[- 1 ], [4 ]],
504+ ],
505+ [
506+ [[10 , 1 ], [20 , 1 ]],
507+ [[20 , 1 ], [30 , 1 ]],
508+ ],
509+ ),
510+ TransferFunction (
511+ [
512+ [[4 ], [2 ]],
513+ [[- 2 ], [8 ]],
514+ ],
515+ [
516+ [[10 , 1 , 0 ], [20 , 1 , 0 ]],
517+ [[20 , 1 , 0 ], [30 , 1 , 0 ]],
518+ ],
519+ ),
520+ ),
521+ (
522+ TransferFunction (
523+ [
524+ [[2 ], [1 ]],
525+ [[- 1 ], [4 ]],
526+ ],
527+ [
528+ [[10 , 1 ], [20 , 1 ]],
529+ [[20 , 1 ], [30 , 1 ]],
530+ ],
531+ ),
532+ TransferFunction ([2 ], [1 , 0 ]),
533+ TransferFunction (
534+ [
535+ [[4 ], [2 ]],
536+ [[- 2 ], [8 ]],
537+ ],
538+ [
539+ [[10 , 1 , 0 ], [20 , 1 , 0 ]],
540+ [[20 , 1 , 0 ], [30 , 1 , 0 ]],
541+ ],
542+ ),
543+ ),
544+ (
545+ TransferFunction ([2 ], [1 , 0 ]),
546+ np .eye (3 ),
547+ TransferFunction (
548+ [
549+ [[2 ], [0 ], [0 ]],
550+ [[0 ], [2 ], [0 ]],
551+ [[0 ], [0 ], [2 ]],
552+ ],
553+ [
554+ [[1 , 0 ], [1 ], [1 ]],
555+ [[1 ], [1 , 0 ], [1 ]],
556+ [[1 ], [1 ], [1 , 0 ]],
557+ ],
558+ ),
559+ ),
560+ ]
561+ )
562+ def test_mul_mimo_siso (self , left , right , expected ):
563+ result = frd (left , np .logspace (- 1 , 1 , 10 )).__mul__ (right )
564+ expected_frd = frd (expected , np .logspace (- 1 , 1 , 10 ))
565+ np .testing .assert_array_almost_equal (expected_frd .omega , result .omega )
566+ np .testing .assert_array_almost_equal (expected_frd .fresp , result .fresp )
567+
568+ @pytest .mark .parametrize (
569+ "left, right, expected" ,
570+ [
571+ (
572+ TransferFunction ([2 ], [1 , 0 ]),
573+ TransferFunction (
574+ [
575+ [[2 ], [1 ]],
576+ [[- 1 ], [4 ]],
577+ ],
578+ [
579+ [[10 , 1 ], [20 , 1 ]],
580+ [[20 , 1 ], [30 , 1 ]],
581+ ],
582+ ),
583+ TransferFunction (
584+ [
585+ [[4 ], [2 ]],
586+ [[- 2 ], [8 ]],
587+ ],
588+ [
589+ [[10 , 1 , 0 ], [20 , 1 , 0 ]],
590+ [[20 , 1 , 0 ], [30 , 1 , 0 ]],
591+ ],
592+ ),
593+ ),
594+ (
595+ TransferFunction (
596+ [
597+ [[2 ], [1 ]],
598+ [[- 1 ], [4 ]],
599+ ],
600+ [
601+ [[10 , 1 ], [20 , 1 ]],
602+ [[20 , 1 ], [30 , 1 ]],
603+ ],
604+ ),
605+ TransferFunction ([2 ], [1 , 0 ]),
606+ TransferFunction (
607+ [
608+ [[4 ], [2 ]],
609+ [[- 2 ], [8 ]],
610+ ],
611+ [
612+ [[10 , 1 , 0 ], [20 , 1 , 0 ]],
613+ [[20 , 1 , 0 ], [30 , 1 , 0 ]],
614+ ],
615+ ),
616+ ),
617+ (
618+ np .eye (3 ),
619+ TransferFunction ([2 ], [1 , 0 ]),
620+ TransferFunction (
621+ [
622+ [[2 ], [0 ], [0 ]],
623+ [[0 ], [2 ], [0 ]],
624+ [[0 ], [0 ], [2 ]],
625+ ],
626+ [
627+ [[1 , 0 ], [1 ], [1 ]],
628+ [[1 ], [1 , 0 ], [1 ]],
629+ [[1 ], [1 ], [1 , 0 ]],
630+ ],
631+ ),
632+ ),
633+ ]
634+ )
635+ def test_rmul_mimo_siso (self , left , right , expected ):
636+ result = frd (right , np .logspace (- 1 , 1 , 10 )).__rmul__ (left )
637+ expected_frd = frd (expected , np .logspace (- 1 , 1 , 10 ))
638+ np .testing .assert_array_almost_equal (expected_frd .omega , result .omega )
639+ np .testing .assert_array_almost_equal (expected_frd .fresp , result .fresp )
640+
495641 def test_eval (self ):
496642 sys_tf = ct .tf ([1 ], [1 , 2 , 1 ])
497643 frd_tf = frd (sys_tf , np .logspace (- 1 , 1 , 3 ))
0 commit comments