ODE Event Finding Accuracy

조회 수: 1 (최근 30일)
Grant Hecht
Grant Hecht 2021년 2월 19일
댓글: Grant Hecht 2021년 2월 19일
I'm working on a project that requires that I determine when an ODE event occurs with a very high degree of accuracy. Looking at MATLAB's documentation, I've been unable to find any information on how to set the error tollerance for the root finding method or exactly how accurate the root finding method used for determining event locations is.
Is it somehow possible to set abs/rel tollerance on the root finding method that MATLAB uses to determine where ODE events occur? I've recently been using the Julia programming language with it's DifferentialEquations.jl package which allows me to explicitly define the absolute and relative error tolorance for the Regula-Falsi root finding method used to determine where events occur. Ideally, I would like to do this exact thing with MATLABs ODE event handling.
  댓글 수: 1
Bjorn Gustavsson
Bjorn Gustavsson 2021년 2월 19일
Have you checked that it isn't good enough? For ballode I get the event-time to be accurate with a relative error of 2.75e-14...

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

채택된 답변

Grant Hecht
Grant Hecht 2021년 2월 19일
편집: Grant Hecht 2021년 2월 19일
I ended up answering my own question... digging into the source code a little I found that MATLAB uses Regula Falsi with a tollerance computed as 128*max(eps(t),eps(tnew)) to determine where an event occured. I wish MATLAB had a way of specifying the tollerance used in the root finding routine via odeset() so I could decrease it to around 10*eps(t) (which is what I used in Julia) but for the time being, I looks like I'm stuck with the default.
If anyone knows of a way to specify a different tollerence please let me know. I attempted to edit the souce code in odezero.m but realized the source code is unfortunately read only.
  댓글 수: 2
Bjorn Gustavsson
Bjorn Gustavsson 2021년 2월 19일
If you write your own odezero function with identical behaviour you can at least hard-code the tolerance you need, and if this function is found before the odezero of Mathworks then yours will be used. This is obviously system-programming-wise a very dubious thing to do since you'll have to manually control which function to use/have been used. The legalities I don't know about, but as long as you dont sell or redustribute and don't copy the interior of the original function bu only the input-output?
Grant Hecht
Grant Hecht 2021년 2월 19일
I'll have to try this out! I just assumed that MATLAB's source code would take precidence over any user defined functions on MATLAB's path but thinking about it further, it wouldn't make much sence for MATLAB to behave this way. Thank you for the suggestion!

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

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by