When using numerical solvers like "ode15s", multiple calls to the derivative function ("odefun") at t = 0 can occur for various reasons:
- Initialization: The solver needs to initialize the integration process, which involves estimating an appropriate initial step size. This initialization may require evaluating the derivative function at t = 0 multiple times to gather information about the system's behaviour.
- Step Size Adjustment: During the initialization phase and throughout the integration process, the solver may adjust the step size dynamically to ensure accuracy and stability. This adjustment may involve evaluating the derivative function at t = 0 and at other points to determine an optimal step size for the next integration step.
- Adaptive Time Stepping: Many numerical solvers use adaptive time-stepping techniques, where the step size is adjusted based on the local behaviour of the solution. This adaptation process may lead to additional evaluations of the derivative function at t = 0 and other points to refine the integration.
- Event Handling: If your system includes events (e.g., discontinuities, zero crossings), the solver may need to refine the solution around these events, which could result in additional evaluations of the derivative function at t = 0 and other relevant points.
- According to the official MathWorks documentation available here https://www.mathworks.com/help/releases/R2021a/matlab/ref/ode15s.html#bu8tot8:~:text=the%20solver%20detected.-,Algorithms,-ode15s%20is%20a , the solver can optionally use backward differentiation formulas (BDFs, also known as Gear's method) that are usually less efficient.
Hope this helps !