Approximate derivative within ODE function.
Show older comments
Hi, I am solving a pretty big system of differential equations using 'ode15s'. Within the ODE function, I would like to calculate the second derivative of a variable for which I don't have an analytical expression (even though I know its first derivative). I wonder if there's any possible way to calculate an approximate second derivative for that variable, considering that this last appears in other model's equations.
Thanks in advance, Davide
1 Comment
Star Strider
on 13 Nov 2017
Davide Masiello’s follow-up Comment to my (now deleted) Answer:
I need to calculate the second derivative in the ODE function script because it appears as a member of other equations constituting the model, as in the following example:

where the second derivative of x is not given to know analytically. In the past, I used to stop the integration at a fixed and arbitrarily small time step to calculate the approximate derivative and then keep integrating with the last calculated value as new initial one, but I'd like to avoid this as the code runs correctly only with a varying step size. That's why I am wondering whether there's a more elegant solution to this problem.
Accepted Answer
More Answers (0)
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!