How to get the time step used in PDEPE solver?

6 views (last 30 days)
For PDEPE, Matlab guide says. "The pdepe function performs the time integration with an ODE solver that selects both the time step and the formula dynamically."
How to get the actual time step used by PDEPE as an ouput?

Answers (1)

Torsten on 10 Aug 2022
Edited: Torsten on 10 Aug 2022
pdepe uses ode15s as solver for the arising differential equations.
This solver uses adaptive time stepping - thus if the problem is difficult, small time steps are chosen, if the problem is easy, large time steps are chosen.
The basic time steps (time steps that led to a successful integration step because the error tolerance was satisfied) can be seen after integration has finished if you choose only start and end point of integration for the definition of tspan:
tspan = [tstart tend]
Getting time steps to modify your equations during integration is almost impossible.
Could you explain why you want to get the time steps as output ?
Torsten on 10 Aug 2022
I'd simply use "tspan" according to your needs and calculate the heat fluxes from the solution "sol" (which is supplied for the times defined in "tspan"). Then you don't need the "OutputFcn".

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!