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

7 views (last 30 days)
Hi,
I have a second order ODE of the form:
spp=inv(DD)*(tau-CC*[spx;spy;ap]-gg);
sppx=spp(1);
sppy=spp(2);
app=0;
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.
Thanks

Accepted Answer

Stephan
Stephan on 7 Oct 2019
Edited: Stephan on 7 Oct 2019
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.

More Answers (0)

Products


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!