MATLAB Writing a matlab program to solve the Kepler Problem (Universal Vars)

Click For Summary
The discussion centers on a Matlab program designed to solve the Kepler problem for various types of orbits, including elliptical, hyperbolic, and circular. The program successfully handles these cases but encounters difficulties with parabolic orbits due to the denominator of the semi-major axis (a) approaching zero. This results in complications during calculations, particularly with the initial guesses for iterative solutions, leading to instability in the program. The user has attempted to address this by using series representations for certain calculations when the reciprocal of a, referred to as alpha, is zero. The conversation invites assistance in resolving these issues, particularly in clarifying the relevant equations and addressing the potential misapplication of formulas intended for elliptical orbits, where eccentricity is constrained to values between zero and one.
Julez55
Messages
3
Reaction score
0
TL;DR
I'm writing a matlab program to solve the Kepler problem for all orbit cases. It works successfully for Elliptic, Circular, and Hyperbolic. The case of hyperbolic orbits where a blows up is giving me trouble.
Introduction: I am writing a Matlab program that solves the Kepler problem for any Elliptical, Hyperbolic, or Circular orbit. Given an initial position vector, velocity vector, find the position vector and velocity vector after some given time. I am not doing this for any class, I have been doing this to work on my computer science abilities. The textbook I am using is "Fundamentals of Astrodynamics" by Bate, Mueller, and White. The specific program I am working on is a suggested project in the back of the book.

The Problem: My program successfully solves the Kepler problem for all elliptical, hyperbolic, and circular orbits. However, I'm having a hard time solving the case of Parabolic orbits where the denominator of a goes to zero. I tried to resolve this by calculating the reciprocal of a, which then, in this case, is zero. This leads to the initial guess of x_n to be zero, and the initial guess of z_n to be zero as well, which causes the iteration to blow up. I also added a case inside the iteration which computes the values of C_n and S_n using their series representations when the reciprocal of a, called alpha in my program is equal to zero. I attached my Matlab program below.

If anybody thinks they can help me with this I would love to have further conversation, I'd really like to figure this one out!
 

Attachments

Physics news on Phys.org
It would really help if you wrote out here the equations of interest. Having a brief look at your code, I believe you are trying to calculate the eccentricity. My guess is that you are using the equation that only works with ##0<e<1##, which is for an ellipse.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 5 ·
Replies
5
Views
2K
Replies
2
Views
2K
Replies
1
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K