我无法向scipy.signal.dlsim方法提供正确的输入.
该方法需要4个状态空间矩阵:
A = np.array([ [0.9056,-0.1908,0.0348,0.0880],[0.0973,0.8728,0.4091,-0.0027],[0.0068,-0.1694,0.9729,-0.6131],[-0.0264,0.0014,0.1094,0.6551] ]) B = np.array([ [0,-0.0003,-0.0330,-0.0042,-0.0037],[0,-0.0005,0.0513,-0.0869,-0.1812],0.0003,-0.0732,1.1768,-1.1799],-0.0002,-0.0008,0.2821,-0.4797] ]) C = np.array([-0.01394,-0.0941,0.0564,0.0435]) D = np.array([0,0.0004,-0.0055,0.3326,0.5383])
和我用以下方式构建的输入向量:
inputs = np.array([ data['input1'].values(),data['input2'].values(),data['input3'].values(),data['input4'].values(),data['input5'].values() ])
这将创建一个具有(5×752)维度的输入矩阵(我有752个数据点).所以我采用输入矩阵的转置来预处理我的数据:
inputs = np.transpose(inputs)
输入矩阵现在具有我认为是scipy仿真算法所必需的(752×5)维度.
110 # Simulate the system 111 for i in range(0,out_samples - 1): --> 112 xout[i+1,:] = np.dot(a,xout[i,:]) + np.dot(b,u_dt[i,:]) 113 yout[i,:] = np.dot(c,:]) + np.dot(d,:]) 114 ValueError: shapes (4,5) and (1,5) not aligned: 5 (dim 1) != 1 (dim 0)
我知道scipy无法进行这种乘法,但我不知道我应该以哪种格式将输入数组提供给方法.如果我不转置矩阵,那么尺寸会更差(1×752).
我在这里错过了什么吗?