How do I integrate the output of an ode23 solver?
Mostrar comentarios más antiguos
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?
Respuestas (2)
Torsten
el 25 de Sept. de 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
el 25 de Sept. de 2018
0 votos
1 comentario
Torsten
el 26 de Sept. de 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.
Categorías
Más información sobre Ordinary Differential Equations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!