How do you deal with very large and very small numbers for ode45?

5 ビュー (過去 30 日間)
Martin
Martin 2013 年 1 月 30 日
Hi there,
I am using the ODE45 function in matlab and am having to do some calculations where the time scale is on the order of 10^-15s (femto seconds) but the period of oscillations are of the order of femto seconds too.
The problem is is that when I start putting this in to the ODE45 routine, it never finishes and I have to ctrl-c it.
I am new to modelling so if there are any good techniques to keep in mind that would be great if you could point them out.
Thanks Martin

採用された回答

Jan
Jan 2013 年 1 月 30 日
編集済み: Jan 2013 年 1 月 30 日
The simplest solution would be to scale the time by a factor of 1e15. This must be considered in the function to be integrated also, but it is very easy to calculate the corresponding derivatives to the time.
But there could be other problems, e.g. if you want to observe a timespan of e.g. 1 sec. Then oscillations in the magnitude of 1e-15 will require about 30'000 years of processing time, when ODE45 can solve the dynamics with 2000 steps per second.
  1 件のコメント
Martin
Martin 2013 年 1 月 30 日
Thanks, I thought about that when I realised the ode45 was going to have to do so many loops going from t0=0 to tf=10 seconds in steps of the order 1e15! I'll try it, again thanks!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by