1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Calculating apoapsis from position and velocity

  1. Feb 13, 2015 #1
    I have a body of negligible mass orbiting a body of considerable mass, with that larger body fixed at the origin. I am given the orbital state vector (position and velocity), and need to return the apoapsis of orbit. Other orbital information would be useful, e.g. energy, angular momentum, eccentricity, etc.

    For simplicity, the system is assumed to be in a plane... I am not concerned with the third position/vector component.

    What I have so far:

    Code (Text):
      energy = norm(v)^2/2-S/norm(p);
      angmom = dot(p,v);
      eccen = sqrt(1+(2*energy*angmom^2)/S^2);
      semimajor = 1/(2/norm(p)-norm(v)^2/S);
      apoapsis = semimajor*(1+norm(eccen));
    Sorry about the formatting, it's in Matlab language. I am far too lazy to do the latex for such a simple question. The above formulae do not return the correct results.

    EDIT: Huh... it may work now. ??????
    Last edited: Feb 13, 2015
  2. jcsd
  3. Feb 14, 2015 #2


    User Avatar
    2017 Award

    Staff: Mentor

    What is correct, what do you get, and where do the formulas come from?
  4. Feb 14, 2015 #3
    mfb: The apoapsis changes drastically in different parts of the orbit, and I know the physics code is already correct, so it must be this. The formulae are thrown together from various sources, like Wikipedia and a paper I found on these forums.

    The above may or may not be correct, I'm not sure. Mathematically, how does one normally calculate orbital parameters given position and velocity (and standard gravitational parameter, S)
  5. Feb 14, 2015 #4


    User Avatar
    Science Advisor
    Gold Member

  6. Feb 14, 2015 #5
    Wow Tony, you made that? I found that when searching for an orbital simulator, but didn't use it because the orbital elements were not obvious. Thanks.
  7. Feb 14, 2015 #6


    User Avatar
    Science Advisor
    Gold Member

    If you hover the mouse over a text box, it tells you in English what each box means, in case you don't like Greek variables.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook