How do I integrate the output of an ode23 solver?
Afficher commentaires plus anciens
In my specific problem I have solved an ODE with ode23 resulting in two 11x1 double vectors (E and r). The dr's resulitng are equal in size, in this case. The integrate function does work on these variable types, or can it? Creating a simple "for" loop multiplying E(i)*dr and summing is too course (11 points) and gives the wrong answer, which I know exactly. The plotted output of ode23 shows a solid line between the 11 points. So, some kind of extrapolation or estimated function must exist, or? That then could be integrated with the function integrate, or?
Réponses (2)
Torsten
le 25 Sep 2018
Solve the additional ODE
dI/dt = E(t)*dr/dt
then
I(T) = integral_{t=0}^{t=T} E(t) dr
Best wishes
Torsten.
Marc Jeroense
le 25 Sep 2018
0 votes
1 commentaire
Torsten
le 26 Sep 2018
If a quantity e is the result of a solution of an ODE
de/dt = ...
and in addition to e, you want to have the integral of e over time (name it E), you can add the differential equation
dE/dt = e, E(0)=0
to your system of ODEs.
Then
E(T) = integral_{t=0}^{t=T} e(t) dt
Best wishes
Torsten.
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!