Sometimes we get spikes in the derivatives at a stage that is shared by two intervals, eg:
state_derivative
state
What we have checked:
the continuity is computed correctly, so while the states look smooth, it does indeed produce the derivative spike (when fitting a Lagrange polynomial) at those points!
TODO:
understand what causes these derivative spikes
fix them
Thoughts
one suspicion is that these spikes are the results of the large coefficients in the Lagrange polynomial fitted, especially at high order. And then somehow this is taken advantage of by the solver during the optimization -> just a hunch!
another possibility is that we add L2 penalty on inputs on some simulations (here), but the penalty term is not integrated, but just averaged. But actually every point has different 'weights' on the actual results (because of collocation spacing and weights). So maybe try integral penalty? and probably better do it on the delta of inputs, rather than inputs itself.
Sometimes we get spikes in the derivatives at a stage that is shared by two intervals, eg:
state_derivative
state
What we have checked:
TODO:
Thoughts