Skip to content

Commit 53ad0ed

Browse files
committed
fix docstring example errors (in newly included functions)
1 parent 3bd4393 commit 53ad0ed

File tree

3 files changed

+16
-22
lines changed

3 files changed

+16
-22
lines changed

control/bdalg.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -541,26 +541,20 @@ def combine_tf(tf_array):
541541
--------
542542
Combine two transfer functions
543543
544-
>>> s = control.TransferFunction.s
545-
>>> control.combine_tf([
544+
>>> s = ct.tf('s')
545+
>>> ct.combine_tf([
546546
... [1 / (s + 1)],
547547
... [s / (s + 2)],
548548
... ])
549-
TransferFunction([[array([1])], [array([1, 0])]],
550-
[[array([1, 1])], [array([1, 2])]])
549+
TransferFunction([[array([1])], [array([1, 0])]], [[array([1, 1])], [array([1, 2])]])
551550
552551
Combine NumPy arrays with transfer functions
553552
554-
>>> control.combine_tf([
553+
>>> ct.combine_tf([
555554
... [np.eye(2), np.zeros((2, 1))],
556-
... [np.zeros((1, 2)), control.TransferFunction([1], [1, 0])],
555+
... [np.zeros((1, 2)), ct.tf([1], [1, 0])],
557556
... ])
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])]])
557+
TransferFunction([[array([1.]), array([0.]), array([0.])], [array([0.]), array([1.]), array([0.])], [array([0.]), array([0.]), array([1])]], [[array([1.]), array([1.]), array([1.])], [array([1.]), array([1.]), array([1.])], [array([1.]), array([1.]), array([1, 0])]])
564558
"""
565559
# Find common timebase or raise error
566560
dt_list = []
@@ -635,7 +629,7 @@ def split_tf(transfer_function):
635629
--------
636630
Split a MIMO transfer function
637631
638-
>>> G = control.TransferFunction(
632+
>>> G = ct.tf(
639633
... [
640634
... [[87.8], [-86.4]],
641635
... [[108.2], [-109.6]],
@@ -645,7 +639,7 @@ def split_tf(transfer_function):
645639
... [[1, 1], [1, 1]],
646640
... ],
647641
... )
648-
>>> control.split_tf(G)
642+
>>> ct.split_tf(G)
649643
array([[TransferFunction(array([87.8]), array([1, 1])),
650644
TransferFunction(array([-86.4]), array([1, 1]))],
651645
[TransferFunction(array([108.2]), array([1, 1])),

control/lti.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -575,18 +575,18 @@ def bandwidth(sys, dbdrop=-3):
575575
ValueError
576576
if 'dbdrop' is not a negative scalar
577577
578-
Example
579-
-------
578+
Examples
579+
--------
580580
>>> G = ct.tf([1], [1, 1])
581581
>>> ct.bandwidth(G)
582-
0.9976
582+
np.float64(0.9976283451102316)
583583
584584
>>> G1 = ct.tf(0.1, [1, 0.1])
585585
>>> wn2 = 1
586586
>>> zeta2 = 0.001
587587
>>> G2 = ct.tf(wn2**2, [1, 2*zeta2*wn2, wn2**2])
588588
>>> ct.bandwidth(G1*G2)
589-
0.1018
589+
np.float64(0.10184838823897456)
590590
591591
"""
592592
if not isinstance(sys, LTI):

control/xferfcn.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,8 +1247,8 @@ def _isstatic(self):
12471247
#: The ``s`` constant can be used to create continuous time transfer
12481248
#: functions using algebraic expressions.
12491249
#:
1250-
#: Example
1251-
#: -------
1250+
#: Examples
1251+
#: --------
12521252
#: >>> s = TransferFunction.s # doctest: +SKIP
12531253
#: >>> G = (s + 1)/(s**2 + 2*s + 1) # doctest: +SKIP
12541254
#:
@@ -1260,8 +1260,8 @@ def _isstatic(self):
12601260
#: The ``z`` constant can be used to create discrete time transfer
12611261
#: functions using algebraic expressions.
12621262
#:
1263-
#: Example
1264-
#: -------
1263+
#: Examples
1264+
#: --------
12651265
#: >>> z = TransferFunction.z # doctest: +SKIP
12661266
#: >>> G = 2 * z / (4 * z**3 + 3*z - 1) # doctest: +SKIP
12671267
#:

0 commit comments

Comments
 (0)