Merge pull request #1051 from KybernetikJo/improve_style_markov · python-control/python-control@d75082d

Original file line numberDiff line numberDiff line change

@@ -667,21 +667,21 @@ def markov(*args, m=None, transpose=False, dt=None, truncate=False):

667667
668668

# Set up the full problem

669669

# Create matrix of (shifted) inputs

670-

UUT = np.zeros((p*m,(l)))

670+

UUT = np.zeros((p*m, l))

671671

for i in range(m):

672672

# Shift previous column down and keep zeros at the top

673-

UUT[i*p:(i+1)*p,i:] = Umat[:,:l-i]

673+

UUT[i*p:(i+1)*p, i:] = Umat[:, :l-i]

674674
675675

# Truncate first t=0 or t=m time steps, transpose the problem for lsq

676-

YY = Ymat[:,t:].T

677-

UU = UUT[:,t:].T

676+

YY = Ymat[:, t:].T

677+

UU = UUT[:, t:].T

678678
679679

# Solve for the Markov parameters from YY = UU @ H.T

680680

HT, _, _, _ = np.linalg.lstsq(UU, YY, rcond=None)

681681

H = HT.T/dt # scaling

682682
683-

H = H.reshape(q,m,p) # output, time*input -> output, time, input

684-

H = H.transpose(0,2,1) # output, input, time

683+

H = H.reshape(q, m, p) # output, time*input -> output, time, input

684+

H = H.transpose(0, 2, 1) # output, input, time

685685
686686

# for siso return a 1D array instead of a 3D array

687687

if q == 1 and p == 1: