You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
control.matlab.lsim does not work for systems of order > 1 #764
When calling the control.matlab.lsim with a higher-order system (at least 2x2 matrices), there is a prompt:
ValueError: Parameter ``T`` must have same elements as the number of columns in input array ``U``
Inverting U or T does not help. Instead, it prompts a different error with matrix multiplication.
It works properly when calling control.timeresp.forced_response directly, with the "transpose" flag set to false.
The error is likely due to the transpose flag, and its implementation throughout the declaration of control.timeresp.forced_response
In [5]: input_Kalman.shape
Out[5]: (512, 2)
In [6]: x_est, _, _ = control.matlab.lsim(ss_Kalman, input_Kalman, time)
Traceback (most recent call last):
Input In [6] in <cell line: 1>
x_est, _, _ = control.matlab.lsim(ss_Kalman, input_Kalman, time)
File ~/src/python-control/control/matlab/timeresp.py:297 in lsim
out = forced_response(sys, T, U, X0, return_x=True, transpose=True)
File ~/src/python-control/control/timeresp.py:978 in forced_response
raise ValueError('Parameter ``T`` must have same elements as'
ValueError: Parameter ``T`` must have same elements as the number of columns in input array ``U``
In [7]: x_est, _, _ = control.matlab.lsim(ss_Kalman, input_Kalman.T, time)
Traceback (most recent call last):
Input In [7] in <cell line: 1>
x_est, _, _ = control.matlab.lsim(ss_Kalman, input_Kalman.T, time)
File ~/src/python-control/control/matlab/timeresp.py:297 in lsim
out = forced_response(sys, T, U, X0, return_x=True, transpose=True)
File ~/src/python-control/control/timeresp.py:1007 in forced_response
U = _check_convert_array(U, legal_shapes,
File ~/src/python-control/control/timeresp.py:805 in _check_convert_array
raise ValueError(err_msg_start + err_msg)
ValueError: Parameter ``U``: Wrong shape (rows, columns): (512, 2). Expected: (2, 512).
Activity
bnavigator commentedon Aug 24, 2022
Confirmed
bnavigator commentedon Aug 25, 2022
@murrayrm fixed it in #765