Skip to content

Commit

Permalink
truncate appended return vectors
Browse files Browse the repository at this point in the history
  • Loading branch information
bnavigator committed Mar 26, 2021
1 parent d365863 commit a6ea296
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions control/timeresp.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ def forced_response(sys, T=None, U=0., X0=0., transpose=False,
if U.ndim == 1:
U = np.append(U, U[-1])
else:
U = np.append(U, U[:, -1], 1)
U = np.append(U, U[:, -1:], 1)

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

return _process_time_response(sys, tout, yout, xout, transpose=transpose,
return _process_time_response(sys, tout[:n_steps], yout[:, :n_steps],
xout[:, :n_steps], transpose=transpose,
return_x=return_x, squeeze=squeeze)


Expand Down

0 comments on commit a6ea296

Please sign in to comment.