ODE solvers for non-unique data

17 ビュー (過去 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 Center および File ExchangeOrdinary Differential Equations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by