MATLAB Answers


Relative / Absolute error plot for ode solver in MATLAB

Pavel Maksimov さんによって質問されました 2019 年 7 月 1 日
最新アクティビティ Jan
さんによって コメントされました 2019 年 7 月 2 日
I am trying to solve a system of partial differential equations with ode15s in Matlab.
To gain more insight regarding reliability of the solution being obtained, I would like to analyze values of relative and absolute errors.
Could you please tell me whether it is possible to somehow plot the value of absolute error (or relative error) vs iteration count, if I use the built in matlab ode solver (ode15s)?
To be more precise - I would like to achieve some kind of a convergence plot (like in the majority of CFD applications).
Thanks in advance!

  3 件のコメント

2019 年 7 月 1 日
"some kind of a convergence plot (like in the majority of CFD applications)" - I cannot guess, what you mean. The relative and absolute errors between what? Between the estimated and exact solution?
Pavel Maksimov 2019 年 7 月 1 日
Yes, exactly, I am interested in the error between estimated and exact solutions. In other words I would like to check how the system is being converged.
Sorry for the lack of clarity.
Unfortunately, I don't have much experience in terms of advanced differential calculation in matlab. In case if my question is irrational - I would really appreciate if you could enlighten me as to how exactly my reasoning is incorrect.
2019 年 7 月 2 日
Start with explaining, what your inputs are. Do you have an analytical solution? If not, you cannot calculate the difference bewteen the estimated and exact solution.
How do you define "reliability"? This term should include the stability of the system also and this means an analysis of the sensitiviy of the results for small variations of the initial position and of the parameters. A simulation of a pencil standing on its tip might be 100% exact and accurate, but as long as the simulation claims, that the pencil will stand vertically forever, it is junk. Another example is a bean machine ( ): The difference between the estimated and exact solution is not meaningful, because the "exact" solution is extremely sensitive for microskopic variations.
Matlab's ODE solvers use an estimation of the local discretization error for the step size control. The values are not exported such that you need to modify a copy (!) of the function to get them. Controlling the accumulated rounding errors would work by computing the Wronski matrix for each step, which is the change of the trajectory for variables of the inputs. In case of the bean machine, the wronski matrix will explode, which is a very useful information: This means, that the physical system cannot be simulated by a standard ODE solver without introducing special functions to consider the random behavior.
So before you can analyse the reliability of an integration, you have to define exactly and with great care, what you call "reliable" for your specific system. I've seen too many scientists, who fed an ODE integrator with some initial values and parameters and used the final values as "result" withozut any further analysis. This is like a medical treatment of a person only based on a measurement with a clinical thermometer.

サインイン to comment.



0 件の回答

Translated by