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

5 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Jan
Jan el 30 de En. de 2013
Editada: Jan el 30 de En. de 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 comentario
Martin
Martin el 30 de En. de 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!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by