MATLAB - Motion of a body around a central one

In summary, the speaker has written a code using ode45 to describe the motion of a body around a central one with initial values set for an elliptical trajectory. They have managed to reduce the error in energy using relative and absolute tolerance, but are struggling to reduce the error in angular momentum. They have tried adjusting the step size and are wondering if using the Verlet method or other ode solvers may help to enforce constraints and improve the angular momentum error.
  • #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.

ptp5dPz.jpg

olFVQ7A.jpg
 
Physics news on Phys.org
  • #2
I think that function uses the Runge-Kutta Method. The Runge-Kutta method is prone to energy error divergence at a long timescale when the true orbit should be periodic. The Verlet method allows bounded error in energy for periodic orbits. I am not sure if using Verlet instead would lead to better angular momentum error. I am not sure about the issue you are having with angular momentum error or how to improve it except smaller step size.

I am also wondering about ode solvers which might be able to enforce constraints like conserved energy somehow.
 
  • #3
MisterX said:
I think that function uses the Runge-Kutta Method. The Runge-Kutta method is prone to energy error divergence at a long timescale when the true orbit should be periodic. The Verlet method allows bounded error in energy for periodic orbits. I am not sure if using Verlet instead would lead to better angular momentum error. I am not sure about the issue you are having with angular momentum error or how to improve it except smaller step size.

I am also wondering about ode solvers which might be able to enforce constraints like conserved energy somehow.

It does use the Runge-Kutta method and you can see from the results that the error in energy is very small so I don't really have a problem with that.
However, the angular momentum stays the same regardless of the step size I take...
 

1. What is MATLAB and how is it used in studying motion of a body around a central one?

MATLAB (Matrix Laboratory) is a programming language and computing environment commonly used in scientific and engineering fields. It is used to analyze and visualize data, solve complex mathematical problems, and simulate physical systems. In studying motion of a body around a central one, MATLAB can be used to create mathematical models, simulate trajectories, and analyze the behavior of the system.

2. What is a central force and how does it affect the motion of a body?

A central force is a type of force that acts towards or away from a fixed point, known as the center of force. In the context of motion of a body around a central one, this force acts as the gravitational force between two objects or the electrostatic force between charged particles. The direction of the central force always points towards or away from the center, and it affects the motion of the body by altering its velocity and trajectory.

3. How can MATLAB be used to plot the trajectory of a body moving around a central one?

MATLAB has built-in functions and tools that can be used to plot the trajectory of a body moving around a central one. These include the "plot" and "polarplot" functions, which can be used to create 2D and polar plots respectively. By inputting the necessary parameters such as initial conditions, mass, and central force, MATLAB can generate a visual representation of the trajectory of the body.

4. Can MATLAB be used to analyze the stability of a body's orbit around a central one?

Yes, MATLAB has various functions and tools that can be used to analyze the stability of a body's orbit around a central one. These include the "eig" function, which can calculate the eigenvalues and eigenvectors of a system, and the "ode45" function, which can solve differential equations that describe the motion of the body. By analyzing the eigenvalues and solving the differential equations, MATLAB can determine the stability of the orbit.

5. Are there any limitations to using MATLAB for studying motion of a body around a central one?

While MATLAB is a powerful tool for studying motion of a body around a central one, there are some limitations to consider. One limitation is that it assumes the system is ideal, meaning there are no external forces or disturbances acting on the body. Additionally, the accuracy of the simulation depends on the accuracy of the initial conditions and parameters inputted by the user. It is important to validate the results with experimental data to ensure accuracy.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
13
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
Replies
5
Views
788
  • Introductory Physics Homework Help
Replies
9
Views
690
Back
Top