Skip to content

Commit a6ea296

Browse files
committed
truncate appended return vectors
1 parent d365863 commit a6ea296

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

control/timeresp.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ def forced_response(sys, T=None, U=0., X0=0., transpose=False,
449449
if U.ndim == 1:
450450
U = np.append(U, U[-1])
451451
else:
452-
U = np.append(U, U[:, -1], 1)
452+
U = np.append(U, U[:, -1:], 1)
453453

454454
else:
455455
sys_dt = dt # For unspecified sampling time, use time incr
@@ -472,7 +472,8 @@ def forced_response(sys, T=None, U=0., X0=0., transpose=False,
472472
xout = np.transpose(xout)
473473
yout = np.transpose(yout)
474474

475-
return _process_time_response(sys, tout, yout, xout, transpose=transpose,
475+
return _process_time_response(sys, tout[:n_steps], yout[:, :n_steps],
476+
xout[:, :n_steps], transpose=transpose,
476477
return_x=return_x, squeeze=squeeze)
477478

478479

0 commit comments

Comments
 (0)