Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions control/descfcn.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ def describing_function(

# Go through all of the amplitudes we were given
retdf = np.empty(np.shape(A), dtype=complex)
df = retdf # Access to the return array
df.shape = (-1, ) # as a 1D array
df = retdf.reshape((-1, )) # Access to the return array as a 1D array
for i, a in enumerate(np.atleast_1d(A)):
# Make sure we got a valid argument
if a == 0:
Expand Down
8 changes: 4 additions & 4 deletions control/lti.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,15 +706,15 @@ def bandwidth(sys, dbdrop=-3):
Examples
--------
>>> G = ct.tf([1], [1, 1])
>>> ct.bandwidth(G)
np.float64(0.9976283451102316)
>>> ct.bandwidth(G) # doctest: +ELLIPSIS
np.float64(0.99762834511023...)

>>> G1 = ct.tf(0.1, [1, 0.1])
>>> wn2 = 1
>>> zeta2 = 0.001
>>> G2 = ct.tf(wn2**2, [1, 2*zeta2*wn2, wn2**2])
>>> ct.bandwidth(G1*G2)
np.float64(0.10184838823897456)
>>> ct.bandwidth(G1*G2) # doctest: +ELLIPSIS
np.float64(0.10184838823897...)

"""
if not isinstance(sys, LTI):
Expand Down
2 changes: 1 addition & 1 deletion control/modelsimp.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def hankel_singular_values(sys):
WoWc = Wo @ Wc
w, v = np.linalg.eig(WoWc)

hsv = np.sqrt(w)
hsv = np.sqrt(w.real)
hsv = np.array(hsv)
hsv = np.sort(hsv)
# Return the Hankel singular values, high to low
Expand Down
1 change: 1 addition & 0 deletions control/phaseplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,7 @@ def separatrices(
timepts = np.linspace(0, timescale)

# Run the trajectory starting in eigenvector directions
dir = dir.real # use real components only
for eps in [-radius, radius]:
x0 = xeq + dir * eps
if evals[j].real < 0:
Expand Down
6 changes: 3 additions & 3 deletions control/statesp.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@ def __init__(self, *args, **kwargs):

# Reset shapes if the system is static
if static:
A.shape = (0, 0)
B.shape = (0, self.ninputs)
C.shape = (self.noutputs, 0)
A = A.reshape((0, 0))
B = B.reshape((0, self.ninputs))
C = C.reshape((self.noutputs, 0))

# Check to make sure everything is consistent
_check_shape(A, self.nstates, self.nstates, name="A")
Expand Down
3 changes: 1 addition & 2 deletions control/tests/ctrlplot_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,8 +748,7 @@ def test_pole_zero_subplots(savefig=False):
sys2 = ct.tf([1, 0.2], [1, 1, 3, 1, 1], name='sys2')
ct.root_locus_plot([sys1, sys2], ax=ax_array[0, 0])
cplt = ct.root_locus_plot([sys1, sys2], ax=ax_array[1, 0])
with pytest.warns(UserWarning, match="Tight layout not applied"):
cplt.set_plot_title("Root locus plots (w/ specified axes)")
cplt.set_plot_title("Root locus plots (w/ specified axes)")
if savefig:
plt.savefig("ctrlplot-pole_zero_subplots.png")

Expand Down
2 changes: 1 addition & 1 deletion control/tests/nyquist_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def test_nyquist_indent_im():

def test_nyquist_indent_near_imaginary_axis():
"""Test indent direction for poles near the imaginary axis."""
sys = ct.tf([1, 11, 10], [0.01, 1, 0.01, 1])
sys = ct.zpk([-10, -1], [-100, 0.001+1j, 0.001-1j], 10)
omega = np.linspace(0, 2, 21)

_, contour_default = ct.nyquist_response(
Expand Down
4 changes: 2 additions & 2 deletions doc/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,5 @@ This documentation has a number of notional conventions and functionality:
.. doctest::

>>> sys = ct.tf([1], [1, 0.5, 1])
>>> ct.bandwidth(sys)
np.float64(1.4839084518312828)
>>> ct.bandwidth(sys) # doctest: +ELLIPSIS
np.float64(1.4839084518312...)
Loading