ODE with variable time vector

3 views (last 30 days)
Simon
Simon on 7 Oct 2015
Answered: Star Strider on 7 Oct 2015
Hello, t is my time vector which is defined as
t = tstart:dt:tend;
The ODE is solved this way:
ode15s(@ode, t, ...)
At a known time, the gradient dxdt gets in a very short time to a very high value.
To solve this, dt must be very small. The rest of ODE could be solved with a dt which is several times higher.
Can I give a time vector with a variable scale? Or have I to define three seperate ode solver with the required time vector?

Answers (1)

Star Strider
Star Strider on 7 Oct 2015
Your time vector can be whatever you want it to be (providing it has at least three elements), but those will be the times the ODE solver outputs the results of the integration. The solver will evaluate your ODE with adaptive time intervals just as it normally would.
If you have discontinuities in your ODE function, you can usually see them by plotting the ODE function first, and defining your time vector to avoid them.

Community Treasure Hunt

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

Start Hunting!