Matlab ode45 Help: Solving Orbital Propagation Issues

In summary, the conversation discusses the creation of an orbit propagator for a specified body, which successfully displays a circular orbit for a satellite in geosynchronous orbit and the Earth for one year. However, when attempting to propagate further into the future, the graph begins to spiral inwards. The code for the orbit propagator and the use of the ode45 function are also mentioned. The issue is resolved by adjusting the tolerances using the odeset function.
  • #1
Hashmeer
16
0

Homework Statement


I need to create an orbit propagator for the orbit of a specified body and graph it. I've written a code that works and correctly gives me a circular orbit for a satellite in geosynchronous orbit and it appears to correctly display the orbit of the Earth for one year. I'm running into trouble when I attempt to propagate further into the future. My graph then begins to spiral inwards instead of maintaining its path.

The Attempt at a Solution



I am using ode45 for this. Here is the code (first is the ode function, second is the run script):

Code:
function dP = orbitProp( t, P )
% Equations of motion for a 2D orbit
% P = [x position, y position, x velocity (vx), y velocity (vy)] 
 
mu = 1.32712440018e+11; % gravitational parameter in km^3/s^2
 
r = sqrt( P(1)^2 + P(2)^2);
 
dP = zeros(4,1);
dP(1) = P(3);
dP(2) = P(4);
dP(3) = -(mu/r^3)*P(1);
dP(4) = -(mu/r^3)*P(2);
end% set initial conditions, (position in km and velocity in km/s)
x0 = [ -1.458240050323911e+08, 3.114907245044354e+07, -6.715255132769428, -29.26108860586488];
 
% integrate forward in time 1 day (1 year = 3.15581e+07)
[T, Y] = ode45(@orbitProp,[0,3.15581e+07],x0);
% plot results
plot(Y(:,1),Y(:,2));
xlabel('X(km)');
ylabel('Y(km)');

The data comes from JPL's HORIZONS and are the values as of 03/09/2011 at 12:00am.

My instructor said that using odeoptions should allow me to clear this up, but I'm not sure exactly how to use them or what I should even be looking for to clean the graph up.

Any help/hints are appreciated. Thanks!
 
Physics news on Phys.org
  • #2
Well I guess it is quite late but I am working on a similar project and you just needed to adjust tolerances using odeset. Using the following code gives a circle even for a year of integration.

Code:
options = odeset('RelTol',1e-10,'AbsTol',1e-11);
[T, Y] = ode45(@orbitProp,[0,365 * 3.15581e+07],x0,options);
 

FAQ: Matlab ode45 Help: Solving Orbital Propagation Issues

What is Matlab ode45 and how does it help with solving orbital propagation issues?

Matlab ode45 is a built-in function in Matlab that solves ordinary differential equations (ODEs) using a Runge-Kutta method. It is commonly used in orbital mechanics to numerically solve the equations of motion for a satellite or spacecraft.

What are some common issues that can arise when using ode45 for orbital propagation?

Some common issues that can arise when using ode45 for orbital propagation include numerical instability, accuracy issues, and convergence problems. These issues can lead to incorrect orbital predictions and require careful consideration when selecting the appropriate solver settings.

How do I choose the appropriate ode45 settings for solving orbital propagation issues?

Choosing the appropriate ode45 settings for solving orbital propagation issues depends on the specific problem at hand. Factors to consider include the desired accuracy, the complexity of the equations of motion, and the time span over which the orbit needs to be propagated. Experimentation and testing with different settings may be necessary to find the optimal solution.

What are some alternative methods for solving orbital propagation problems?

Some alternative methods for solving orbital propagation problems include other numerical integration methods such as ode23 and ode113, as well as analytical methods such as the Keplerian elements. Each method has its own advantages and limitations, and the choice will depend on the specific problem and the desired level of accuracy.

Are there any resources available for further help with using ode45 for orbital propagation?

Yes, there are various resources available for further help with using ode45 for orbital propagation. These include online tutorials, forums, and documentation provided by Matlab. Additionally, there are textbooks and research papers that discuss the use of ode45 in orbital mechanics. It is also recommended to consult with experienced colleagues or experts in the field for guidance and advice.

Similar threads

Back
Top