- #1
MMS
- 148
- 4
Hello everyone,
I've written a code using ode45 which describes the motion of a body m around a central one M (e.g a satellite around earth). I've done it with initial values that set the trajectory of the particle to be elliptic.
Clearly, energy and angular momentum need be conserved in this and so I get. However, I'm looking to reduce the error as much as possible and get a more accurate solution.
For the energy, I've managed to get a really small one using the relative and absolute tolerance. For example, for some parameters of RelTol and AbsTol, the relative error can reach a maximum value of about ~1e-8% only for 50 periods. However, the relative error in angular momentum doesn't seem to be affected by whatever I set the RelTol and AbsTol to be and the maximum value that it reaches (it is periodic, see the graph below) is constant at 11.36%.
I've already tried playing with the step size as well and it doesn't seem to affect it.
You can see two images below that describe the energy and angular momentum in 50 periods. The y-axis describes the relative error (not in percentage) in each parameter and the x-axis describes the number of periods (50 in this case).
Does anyone have any suggestion as to how to control and diminish the relative error in angular momentum?
Thanks in advance.
I've written a code using ode45 which describes the motion of a body m around a central one M (e.g a satellite around earth). I've done it with initial values that set the trajectory of the particle to be elliptic.
Clearly, energy and angular momentum need be conserved in this and so I get. However, I'm looking to reduce the error as much as possible and get a more accurate solution.
For the energy, I've managed to get a really small one using the relative and absolute tolerance. For example, for some parameters of RelTol and AbsTol, the relative error can reach a maximum value of about ~1e-8% only for 50 periods. However, the relative error in angular momentum doesn't seem to be affected by whatever I set the RelTol and AbsTol to be and the maximum value that it reaches (it is periodic, see the graph below) is constant at 11.36%.
I've already tried playing with the step size as well and it doesn't seem to affect it.
You can see two images below that describe the energy and angular momentum in 50 periods. The y-axis describes the relative error (not in percentage) in each parameter and the x-axis describes the number of periods (50 in this case).
Does anyone have any suggestion as to how to control and diminish the relative error in angular momentum?
Thanks in advance.