ODE solvers for non-unique data

1 visualización (últimos 30 días)
john doe
john doe el 24 de Abr. de 2018
Comentada: john doe el 24 de Abr. de 2018
So at the moment I am using ODE45 to solve an ode for some data that I have. ODE45 does not seem to like data that is not unique. E.g. I have 3 measurements at a time T, but it will not use this. Therefore I have calculated the means at each time point and solved it this way which works nicely. I am just wondering if there is an ODE solver that does not require unique data?
  1 comentario
john doe
john doe el 24 de Abr. de 2018
Although actually upon further inspection the error might be coming from 'interp1' as opposed to the ODE solver. Is there a way around this?

Iniciar sesión para comentar.

Respuesta aceptada

John D'Errico
John D'Errico el 24 de Abr. de 2018
Editada: John D'Errico el 24 de Abr. de 2018
ode45 does not use "data", so this is not really relevant to ode45.
However, interp1 does do interpolation. And interpolation is not meaningful if you have multiple points with the same independent variable, and distinct values for the dependent variable.
The idea is that interpolation returns the exact y, for any given x. But if you have some x that has three distinct values for y, then which of them should it return?
What is typically done is to use the average y if you have replicated x values replacing those multiple values with a single point. That is exactly what you did, and is about all you can ask for in context.
Be careful if someone tells you to perturb the x values slightly, which would in theory allow interp1 to succeed. That will also introduce HUGE local gradients into the problem. If a spline interpolant were used, that would in turn create wild oscillations. Even linear interpolation can have issues.
For example, given the set of points...
x = [0 1 1 1 2];
y = [1 2 3 4 5];
At x == 1, what is the value of y? 2, 3, or 4?
  1 comentario
john doe
john doe el 24 de Abr. de 2018
Yes you make a good point. Perhaps it really isn't necessary for me to do it at each unique value and a mean is good enough. Thank you for your response.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by