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

5 Ansichten (letzte 30 Tage)
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

Akzeptierte Antwort

Jan
Jan am 30 Jan. 2013
Bearbeitet: Jan am 30 Jan. 2013
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 Kommentar
Martin
Martin am 30 Jan. 2013
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!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by