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

5 vues (au cours des 30 derniers jours)
Martin
Martin le 30 Jan 2013
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

Réponse acceptée

Jan
Jan le 30 Jan 2013
Modifié(e) : Jan le 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 commentaire
Martin
Martin le 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!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by