Change output to ndarray · python-control/python-control@317d261

@@ -438,21 +438,9 @@ def markov(data, m=None, dt=True, truncate=False):

438438439439

Returns

440440

-------

441-

H : TimeResponseData

442-

Markov parameters / impulse response [D CB CAB ...] represented as

443-

a :class:`TimeResponseData` object containing the following properties:

444-445-

* time (array): Time values of the output.

446-447-

* outputs (array): Response of the system. If the system is SISO,

448-

the array is 1D (indexed by time). If the

449-

system is not SISO, the array is 3D (indexed

450-

by the output, trace, and time).

451-452-

* inputs (array): Inputs of the system. If the system is SISO,

453-

the array is 1D (indexed by time). If the

454-

system is not SISO, the array is 3D (indexed

455-

by the output, trace, and time).

441+

H : ndarray

442+

First m Markov parameters, [D CB CAB ...]

443+456444457445

Notes

458446

-----

@@ -557,23 +545,8 @@ def markov(data, m=None, dt=True, truncate=False):

557545

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

558546

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

559547560-

# Create unit area impulse inputs

561-

inputs = np.zeros((p,p,m))

562-

trace_labels, trace_types = [], []

563-

for i in range(p):

564-

inputs[i,i,0] = 1/dt # unit area impulse

565-

trace_labels.append(f"From {data.input_labels[i]}")

566-

trace_types.append('impulse')

548+

if q == 1 and p == 1:

549+

H = np.squeeze(H)

567550568-

# Markov parameters as TimeResponseData with unit area impulse inputs

569551

# Return the first m Markov parameters

570-

return TimeResponseData(time=data.time[:m],

571-

outputs=H,

572-

output_labels=data.output_labels,

573-

inputs=inputs,

574-

input_labels=data.input_labels,

575-

trace_labels=trace_labels,

576-

trace_types=trace_types,

577-

transpose=data.transpose,

578-

plot_inputs=False,

579-

issiso=data.issiso)

552+

return H if not data.transpose else np.transpose(H)