Numpy.dot () sizes are not aligned

I am having trouble providing the correct input to the method scipy.signal.dlsim.

This method requires 4 state space matrices:

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, 0.0003, -0.0732, 1.1768, -1.1799],
    [0, -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])

and the input vector that I create as follows:

inputs = np.array([
    data['input1'].values(),
    data['input2'].values(),
    data['input3'].values(),
    data['input4'].values(),
    data['input5'].values()
])

This creates an input matrix with dimensions (5x752)(I have 752 data points). Therefore, I take the transposition of the input matrix to pre-process my data:

inputs = np.transpose(inputs)

Now the input matrix has dimensions (752x5)that I believe are necessary for the scipy simulation algorithm.

When I run the method, I get the following error:

    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, xout[i,:]) + np.dot(d, u_dt[i,:])
    114 

ValueError: shapes (4,5) and (1,5) not aligned: 5 (dim 1) != 1 (dim 0)

I understand that scipy cannot perform this multiplication, but I do not know in what format I should provide an input array for the method. If I did not transfer the matrix, the dimensions would be even worse (1x752).

- ?

+4
1

numpy.dot() . - , , . , Numpy . : (4x5) x (1x5).

numpy , numpy.dot() , -, np.dot() : (4x5) x (5x1)

+8

All Articles