@@ -164,7 +164,7 @@ def parallel(sys1, *sysn, **kwargs):
164164 or `y`). See :class:`InputOutputSystem` for more information.
165165 states : str, or list of str, optional
166166 List of names for system states. If not given, state names will be
167- of of the form `x[i]` for interconnections of linear systems or
167+ of the form `x[i]` for interconnections of linear systems or
168168 '<subsys_name>.<state_name>' for interconnected nonlinear systems.
169169 name : string, optional
170170 System name (used for specifying signals). If unspecified, a generic
@@ -511,7 +511,7 @@ def connect(sys, Q, inputv, outputv):
511511
512512 return Ytrim * sys * Utrim
513513
514- def combine_tf (tf_array ):
514+ def combine_tf (tf_array , ** kwargs ):
515515 """Combine array-like of transfer functions into MIMO transfer function.
516516
517517 Parameters
@@ -527,6 +527,16 @@ def combine_tf(tf_array):
527527 TransferFunction
528528 Transfer matrix represented as a single MIMO TransferFunction object.
529529
530+ Other Parameters
531+ ----------------
532+ inputs, outputs : str, or list of str, optional
533+ List of strings that name the individual signals. If not given,
534+ signal names will be of the form `s[i]` (where `s` is one of `u`,
535+ or `y`). See :class:`InputOutputSystem` for more information.
536+ name : string, optional
537+ System name (used for specifying signals). If unspecified, a generic
538+ name <sys[id]> is generated with a unique integer id.
539+
530540 Raises
531541 ------
532542 ValueError
@@ -541,26 +551,34 @@ def combine_tf(tf_array):
541551 --------
542552 Combine two transfer functions
543553
544- >>> s = control.TransferFunction.s
545- >>> control.combine_tf([
546- ... [1 / (s + 1)],
547- ... [s / (s + 2)],
548- ... ])
549- TransferFunction([[array([1])], [array([1, 0])]],
550- [[array([1, 1])], [array([1, 2])]])
554+ >>> s = ct.tf('s')
555+ >>> ct.combine_tf(
556+ ... [[1 / (s + 1)],
557+ ... [s / (s + 2)]],
558+ ... name='G'
559+ ... )
560+ TransferFunction(
561+ [[array([1])],
562+ [array([1, 0])]],
563+ [[array([1, 1])],
564+ [array([1, 2])]],
565+ name='G', outputs=2, inputs=1)
551566
552567 Combine NumPy arrays with transfer functions
553568
554- >>> control.combine_tf([
555- ... [np.eye(2), np.zeros((2, 1))],
556- ... [np.zeros((1, 2)), control.TransferFunction([1], [1, 0])],
557- ... ])
558- TransferFunction([[array([1.]), array([0.]), array([0.])],
559- [array([0.]), array([1.]), array([0.])],
560- [array([0.]), array([0.]), array([1])]],
561- [[array([1.]), array([1.]), array([1.])],
562- [array([1.]), array([1.]), array([1.])],
563- [array([1.]), array([1.]), array([1, 0])]])
569+ >>> ct.combine_tf(
570+ ... [[np.eye(2), np.zeros((2, 1))],
571+ ... [np.zeros((1, 2)), ct.tf([1], [1, 0])]],
572+ ... name='G'
573+ ... )
574+ TransferFunction(
575+ [[array([1.]), array([0.]), array([0.])],
576+ [array([0.]), array([1.]), array([0.])],
577+ [array([0.]), array([0.]), array([1])]],
578+ [[array([1.]), array([1.]), array([1.])],
579+ [array([1.]), array([1.]), array([1.])],
580+ [array([1.]), array([1.]), array([1, 0])]],
581+ name='G', outputs=3, inputs=3)
564582 """
565583 # Find common timebase or raise error
566584 dt_list = []
@@ -616,10 +634,14 @@ def combine_tf(tf_array):
616634 "Mismatched number transfer function inputs in row "
617635 f"{ row_index } of denominator."
618636 )
619- return tf .TransferFunction (num , den , dt = dt )
637+ return tf .TransferFunction (num , den , dt = dt , ** kwargs )
638+
620639
621640def split_tf (transfer_function ):
622- """Split MIMO transfer function into NumPy array of SISO tranfer functions.
641+ """Split MIMO transfer function into NumPy array of SISO transfer functions.
642+
643+ System and signal names for the array of SISO transfer functions are
644+ copied from the MIMO system.
623645
624646 Parameters
625647 ----------
@@ -635,21 +657,29 @@ def split_tf(transfer_function):
635657 --------
636658 Split a MIMO transfer function
637659
638- >>> G = control.TransferFunction(
639- ... [
640- ... [[87.8], [-86.4]],
641- ... [[108.2], [-109.6]],
642- ... ],
643- ... [
644- ... [[1, 1], [1, 1]],
645- ... [[1, 1], [1, 1]],
646- ... ],
660+ >>> G = ct.tf(
661+ ... [ [[87.8], [-86.4]],
662+ ... [[108.2], [-109.6]] ],
663+ ... [ [[1, 1], [1, 1]],
664+ ... [[1, 1], [1, 1]], ],
665+ ... name='G'
647666 ... )
648- >>> control.split_tf(G)
649- array([[TransferFunction(array([87.8]), array([1, 1])),
650- TransferFunction(array([-86.4]), array([1, 1]))],
651- [TransferFunction(array([108.2]), array([1, 1])),
652- TransferFunction(array([-109.6]), array([1, 1]))]], dtype=object)
667+ >>> ct.split_tf(G)
668+ array([[TransferFunction(
669+ array([87.8]),
670+ array([1, 1]),
671+ name='G', outputs=1, inputs=1), TransferFunction(
672+ array([-86.4]),
673+ array([1, 1]),
674+ name='G', outputs=1, inputs=1)],
675+ [TransferFunction(
676+ array([108.2]),
677+ array([1, 1]),
678+ name='G', outputs=1, inputs=1), TransferFunction(
679+ array([-109.6]),
680+ array([1, 1]),
681+ name='G', outputs=1, inputs=1)]],
682+ dtype=object)
653683 """
654684 tf_split_lst = []
655685 for i_out in range (transfer_function .noutputs ):
@@ -660,6 +690,9 @@ def split_tf(transfer_function):
660690 transfer_function .num_array [i_out , i_in ],
661691 transfer_function .den_array [i_out , i_in ],
662692 dt = transfer_function .dt ,
693+ inputs = transfer_function .input_labels [i_in ],
694+ outputs = transfer_function .output_labels [i_out ],
695+ name = transfer_function .name
663696 )
664697 )
665698 tf_split_lst .append (row )
0 commit comments