Closed
Description
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
import numpy as np
import control
import control.matlab
time = np.linspace(0.0, 511.0e-6, 512)
DAC = np.sin(time)
ADC = np.cos(time)
input_Kalman = np.transpose(np.concatenate(([[DAC]], [[ADC]]), axis=1)[0])
Af = [[0.45768416, -0.42025511], [-0.43354791, 0.51961178]]
Bf = [[2.84368641, 52.05922305], [-1.47286557, -19.94861943]]
Cf = [[1.0, 0.0], [0.0, 1.0]]
Df = [[0.0, 0.0], [0.0, 0.0]]
ss_Kalman = control.ss(Af, Bf, Cf, Df, 1.0e-6)
x_est, _, _ = control.matlab.lsim(ss_Kalman, input_Kalman, time)