home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 2.ddi / SRC.DI$ / YPRIME.M < prev    next >
Encoding:
Text File  |  1993-03-26  |  944 b   |  22 lines

  1. function yp = yprime(t,y)
  2. % Differential equation system for restricted three body problem.
  3. % Think of a small third body in orbit about the earth and moon.
  4. % The coordinate system moves with the earth-moon system.
  5. % The 1-axis goes through the earth and the moon.
  6. % The 2-axis is perpendicular, in the plane of motion of the third body.
  7. % The origin is at the center of gravity of the two heavy bodies.
  8. % Let mu = the ratio of the mass of the moon to the mass of the earth.
  9. % The earth is located at (-mu,0) and the moon at (1-mu,0). 
  10. % y(1) and y(3) = coordinates of the third body.
  11. % y(2) and y(4) = velocity of the third body.
  12.  
  13. mu = 1/82.45;
  14. mus = 1-mu;
  15. r1 = norm([y(1)+mu, y(3)]);   % Distance to the earth
  16. r2 = norm([y(1)-mus, y(3)]);  % Distance to the moon
  17. yp(1) = y(2);
  18. yp(2) = 2*y(4) + y(1) - mus*(y(1)+mu)/r1^3 - mu*(y(1)-mus)/r2^3;
  19. yp(3) = y(4);
  20. yp(4) = -2*y(2) + y(3) - mus*y(3)/r1^3 - mu*y(3)/r2^3;
  21. yp = yp';
  22.