ODE solvers for non-unique data

조회 수: 1 (최근 30일)
john doe
john doe 2018년 4월 24일
댓글: john doe 2018년 4월 24일
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
john doe
john doe 2018년 4월 24일
Although actually upon further inspection the error might be coming from 'interp1' as opposed to the ODE solver. Is there a way around this?

댓글을 달려면 로그인하십시오.

채택된 답변

John D'Errico
John D'Errico 2018년 4월 24일
편집: John D'Errico 2018년 4월 24일
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
john doe
john doe 2018년 4월 24일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by