필터 지우기
필터 지우기

the length of the time span in ode45

조회 수: 5 (최근 30일)
Tony Cheng
Tony Cheng 2022년 2월 24일
댓글: Torsten 2022년 2월 24일
Hi there,
I am using ode45 to solve a set of ODEs. Here I want to ask, if the length of the time span is relevant to the accuracy of the numerical results? I mean, is there a relationship like, a longer timespan corresponds to a rough accuracy, or a shorter timespan corresponds to a higher accuracy? Many thanks!

채택된 답변

Jan
Jan 2022년 2월 24일
The small discretization and rounding errors accumulate over the time. Small deviations of the initial values can be amplified also. So the general rule is, that a longer integration time can cause larger deviations of the final value.
Of course a stable trajectory does not suffer from this: e.g. a falling pencil will be at the same position and some houres also, so increasing the time will not change anything.
This concerns the real world also: To determine the exact position of the earth in 1 million years, you need to know the current position with an extreme accuracy. But, by the way, even the "year" is not defined accurate enough for this job.
  댓글 수: 2
Tony Cheng
Tony Cheng 2022년 2월 24일
then I will set the timespan in ode45 as [ 0 0.001 ], rather than [ 0 0.1 ].
Jan
Jan 2022년 2월 24일
Usually the length of the time span depends on the problem you want to solve. So if you need the trajectory from 0 to 1, using an earlier final time is not an option.

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

추가 답변 (1개)

Torsten
Torsten 2022년 2월 24일
If by "length of the time span" you mean" the number of output times (for the end time of integration fixed)", the answer is no - it is not relevant for the numerical accuracy of the numerical results.
  댓글 수: 2
Tony Cheng
Tony Cheng 2022년 2월 24일
Thanks for your reply!
What I mean is, for example, for the time span set in ode45, if I set the span as [ 0 0.001 ], will it produce better accuracy in the numerical results than that from [ 0 0.1 ]?
Torsten
Torsten 2022년 2월 24일
At t = 0.001: no.

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

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by