We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent efc42c8 commit 8b08481Copy full SHA for 8b08481
control/tests/timeresp_test.py
@@ -252,7 +252,7 @@ def test_forced_response(self):
252
# first system: initial value, second system: step response
253
u = np.array([[0., 0, 0, 0, 0, 0, 0, 0, 0, 0],
254
[1., 1, 1, 1, 1, 1, 1, 1, 1, 1]])
255
- x0 = np.matrix(".5; 1; 0; 0")
+ x0 = np.array([[.5], [1], [0], [0]])
256
youttrue = np.array([[11., 8.1494, 5.9361, 4.2258, 2.9118, 1.9092,
257
1.1508, 0.5833, 0.1645, -0.1391],
258
[9., 17.6457, 24.7072, 30.4855, 35.2234, 39.1165,
@@ -273,7 +273,7 @@ def test_forced_response(self):
273
# Test discrete MIMO system without default T argument
274
275
276
277
278
279
control/timeresp.py
@@ -273,14 +273,16 @@ def forced_response(sys, T=None, U=0., X0=0., transpose=False,
raise ValueError('Parameters ``T`` and ``U`` can\'t both be'
'zero for discrete-time simulation')
# Set T to equally spaced samples with same length as U
- if len(U.shape) == 1:
+ if U.ndim == 1:
n_steps = U.shape[0]
else:
n_steps = U.shape[1]
280
T = np.array(range(n_steps)) * (1 if sys.dt is True else sys.dt)
281
282
# Make sure the input vector and time vector have same length
283
- if (len(U.shape) == 1 and U.shape[0] != T.shape[0]) or (len(U.shape) > 1 and U.shape[1] != T.shape[0]):
+ # TODO: allow interpolation of the input vector
284
+ if (U.ndim == 1 and U.shape[0] != T.shape[0]) or \
285
+ (U.ndim > 1 and U.shape[1] != T.shape[0]):
286
ValueError('Pamameter ``T`` must have same elements as'
287
' the number of columns in input array ``U``')
288
0 commit comments