Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

B Simulating orbit trajectory based on position and velocity

  1. Sep 21, 2016 #1

    I hope I'm posting in the correct section. I found this very similar topic in this forum: https://www.physicsforums.com/threads/orbital-ellipse.482713/

    Aside from very helpful formula for calculating semi-major axis, the question was left unanswered.

    I have a working simulation of orbital motion of satellites and spaceships, but I'd like to visually represent this flight path based on distance from planet's center of mass and satellite's velocity.

    I assume the best way to do this is by drawing an ellipse, for which I need to know semi-major axis, semi-minor axis and eccentricity or focus. What would be the best process to do this? I don't mind doing some research and reading myself, but I'd like to understand at least the sequence of calculations I need to do.

    Thanks for help in advance.

    Edit: I forgot to mention that I'm simulating everything in two dimensional plane.
    Last edited: Sep 21, 2016
  2. jcsd
  3. Sep 21, 2016 #2
    Start with this:
    Position in two dimensional plane is determined by single variable - distance. Right?
    And for velocity, you need two variables: radial and tangential velocity. Correct?
  4. Sep 21, 2016 #3
    Yes. I know these values. What can I do next based on this?
  5. Sep 21, 2016 #4
    Calling the velocities Vr and Vt, we can note that kinetic energy Ek=mv2/2=m(Vr2+Vt2)/2 - at every point of orbit.
  6. Sep 21, 2016 #5
    Ok, I'm still with you.
  7. Sep 21, 2016 #6
    The second constraint is that the potential energy Ep=-MmG/R.
    Now, conservation of energy means that the total energy
    is constant. If it´s positive, then the orbit is hyperbolic and the satellite escapes; if it is zero then the orbit is parabolic and the satellite also escapes..
    If the energy is negative then the orbit is elliptical or circular.
    Now, the tangential velocity has another constraint: second law of Kepler:
    VtR must be constant.
    Therefore Vt, and therefore also Vt2 cannot go to zero.
  8. Sep 21, 2016 #7
    So: E/m=(Vr2+Vt2)/2-MG/R
    Also Vt=(L/m)/R, for every R.
    Thus: E/m=Vr2/2+[(L/m)2/2]/R2-MG/R
    rearranging, I get
    multiplying by 2
    Observe that this is a quadratic equation for (1/R).
    Last edited: Sep 21, 2016
  9. Sep 21, 2016 #8
    I'll need some time to process this, but I think I understand the general meaning: I can calculate energy from velocity and distance.

    Would you just mind explaining what M, L and R stand for?
  10. Sep 21, 2016 #9
    Now, Vr2 as a square cannot be negative. Whereas the member -(L/M)2/R2 is negative and can get arbitrarily small (?) as 1/R increases.
    Therefore, you can solve the quadratic equation for Vr2=0, and get the two R values where Vr2=0.
    These R values are the distances to apsides.
    Major axis of ellipse is Rmax+Rmin.
    Eccentricity is (Rmax-Rmin)/(Rmax+Rmin)
  11. Sep 21, 2016 #10
    M is the mass of the planet.
    L is the angular momentum of the satellite. I preferred to use the expression (L/m), where m is the mass of satellite.
    R is the distance between planet and satellite.
  12. Sep 22, 2016 #11
    I tried using these equations in my simulation, but I'm getting strange results. Either too big or too small. Would you mind checking my numbers?

    I first tried calculating total energy:

    E = 10000000kg*( (7563.49ms²/2) - ((6E+24kg*6.67408E-11)/7000000m) )
    Mass of the planet is approximate. I didn't include radial velocity, because at this point is zero. Tangential velocity is calculated by the simulation for a circular orbit and it works correctly (as far as I can tell). If I boost this value manually, orbit becomes an ellipse and satellite returns to its starting position.

    Result calculated by the computer is: -286032000000000
    But this is the result I got from windows calculator: -57206399999713968094999500

    I'm obviously making a mistake somewhere...
  13. Sep 22, 2016 #12
    I get:
    Your Windows calculator looks like you´ve put too many zeros to the GM/R part.
    Yes: if you increase tangential speed from a circular orbit, the point becomes a perigee. If the speed remains below the escape speed, the satellite will acquire an elliptical orbit and return to the point of origin.
  14. Sep 22, 2016 #13
    I checked the results coming out of program and they match with your calculations and my original value of E: -286032000000000

    So now comes the difficult part where I'm probably making a mistake. If I understood correctly, next I have to solve quadratic equation with two results:

    I used this formula:

    R_1={ -B + [ sqrt(B²- (4AC) ) ] } / 2 * A
    R_2={ -B - [ sqrt(B²- (4AC) ) ] } / 2 * A

    I identified these elements from the formula you provided:

    A = (L/m)²*-1 (should this be negative?)
    B = 2MG
    C = 2*(E/m)

    Am I doing this correctly? Also, if I understand what you said, the result is actually 1/R, so I should multiply the result with itself?
  15. Sep 22, 2016 #14
    Yes - solve it for Vr=0
    Yes, negative - so no -1 there
    No. You need to take inverse - divide 1 by 1/R
    As it happens, the expression you need to take inverse of is already expressed as a ratio, so that´s easy:
  16. Sep 22, 2016 #15
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted

Similar Discussions: Simulating orbit trajectory based on position and velocity
  1. Orbit Simulator (Replies: 17)

  2. Orbital simulation (Replies: 11)