MATLAB Answers


How can I solve a second order ODE backwards in simulink or matlab?

Asked by Nikolas Haimerl on 7 Oct 2019
Latest activity Commented on by Nikolas Haimerl on 9 Oct 2019
I have a second order ODE of the form:
Let q=(sx,sy,a), qp=(spx,spy,ap) and qpp=(sppx,sppy,app). Where qp=d/dt*q and qpp=d/dt*qp.
DD and CC are matrizes, tau and gg are vectors. These matrizes and vectors may contain variables of the vector q or qp.
I know how to solve this equation in simulink numerically for a specific initial condition at time t=0. However. I would like to know the solution of the ODE if I gave matlab not an initial condition but a solution at a certain point in time t1 != 0.
Specifically, the ODE above describes an object falling through the air and I would like to know the initial conditions q0 at time t=0 if I knew when the object hits the ground. So i know that at time t1 sy=0 and sx is some value sE.
Which method do I use for this kind of problem? I am grateful for any help.


Sign in to comment.




1 Answer

Answer by Stephan
on 7 Oct 2019
Edited by Stephan
on 7 Oct 2019
 Accepted Answer

It is allowed to integrate backwards with ode45 just by declaring tspan backwards:
tspan = [t1 0]
Then your ending conditions are used as initial conditions - you can do this without any special functions.

  1 Comment

Sign in to comment.