-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong time step width in plots generated by Problem.plot_trajectories() #282
Comments
As I know it, the final time is defined as tf = node_time_interval * (num_collection_nodes - 1), |
That would fix the problem as well. But it is currently not implemented that way (see: /opty/direct_collocation.py#L400). |
Maybe you are right, but all the examples I ever saw, the final time was defined a interval * (num-nodes - 1), assuming the starting time is zero. |
Have a look at np.arange(start, stop, step). It defines the interval as [start,stop). In
|
Solved with #283 |
The time array for trajectory plotting created by Problem.plot_trajectories() covers the interval [0,
num_collocation_nodes * node_time_interval
] including the limits while forcing the array size to benum_collocation_nodes
. As a result, the time spacing is not as expected. This is the default behaviour ofnp.linspace()
. Should be fixed by usingnp.arange()
instead.Example for
num_collocation_nodes = 5
,node_time_interval=1
:In the linspace version, the time steps of the resulting array are not 1, which however would be expected because of
node_time_interval=1
.The text was updated successfully, but these errors were encountered: