Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
remove MATLAB-style matrix constructor from string
  • Loading branch information
murrayrm committed Jun 10, 2023
commit af4fa21a883374cecc9f0f099166f6b80da1f5e9
2 changes: 1 addition & 1 deletion control/matlab/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def bode(*args, **kwargs):
--------
>>> from control.matlab import ss, bode

>>> sys = ss("1. -2; 3. -4", "5.; 7", "6. 8", "9.")
>>> sys = ss([[1, -2], [3, -4]], [[5], [7]], [[6, 8]], 9)
>>> mag, phase, omega = bode(sys)

.. todo::
Expand Down
3 changes: 0 additions & 3 deletions control/statesp.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,8 @@ def _ssmatrix(data, axis=1):

"""
# Convert the data into an array or matrix, as configured
# If data is passed as a string, use (deprecated?) matrix constructor
if config.defaults['statesp.use_numpy_matrix']:
arr = np.matrix(data, dtype=float)
elif isinstance(data, str):
arr = np.array(np.matrix(data, dtype=float))
else:
arr = np.array(data, dtype=float)
ndim = arr.ndim
Expand Down
11 changes: 0 additions & 11 deletions control/tests/statesp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,17 +196,6 @@ def test_copy_constructor_nodt(self, sys322):
sys = StateSpace(sysin)
assert sys.dt is None

def test_matlab_style_constructor(self):
"""Use (deprecated) matrix-style construction string"""
with pytest.deprecated_call():
sys = StateSpace("-1 1; 0 2", "0; 1", "1, 0", "0")
assert sys.A.shape == (2, 2)
assert sys.B.shape == (2, 1)
assert sys.C.shape == (1, 2)
assert sys.D.shape == (1, 1)
for X in [sys.A, sys.B, sys.C, sys.D]:
assert ismatarrayout(X)

def test_D_broadcast(self, sys623):
"""Test broadcast of D=0 to the right shape"""
# Giving D as a scalar 0 should broadcast to the right shape
Expand Down
6 changes: 3 additions & 3 deletions control/xferfcn.py
Original file line number Diff line number Diff line change
Expand Up @@ -1640,8 +1640,8 @@ def tf(*args, **kwargs):
>>> G = (s + 1)/(s**2 + 2*s + 1)

>>> # Convert a StateSpace to a TransferFunction object.
>>> sys_ss = ct.ss("1. -2; 3. -4", "5.; 7", "6. 8", "9.")
>>> sys2 = ct.tf(sys1)
>>> sys_ss = ct.ss([[1, -2], [3, -4]], [[5], [7]], [[6, 8]], 9)
>>> sys_tf = ct.tf(sys_ss)

"""

Expand Down Expand Up @@ -1801,7 +1801,7 @@ def ss2tf(*args, **kwargs):
>>> sys1 = ct.ss2tf(A, B, C, D)

>>> sys_ss = ct.ss(A, B, C, D)
>>> sys2 = ct.ss2tf(sys_ss)
>>> sys_tf = ct.ss2tf(sys_ss)

"""

Expand Down