⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 my_yprime_m.m

📁 精通matlab
💻 M
字号:
function yp = yprime(t,y)
% Differential equation system for restricted three body problem.
% Think of a small third body in orbit about the earth and moon.
% The coordinate system moves with the earth-moon system.
% The 1-axis goes through the earth and the moon.
% The 2-axis is perpendicular, in the plane of motion of the third body.
% The origin is at the center of gravity of the two heavy bodies.
% Let mu = the ratio of the mass of the moon to the mass of the earth.
% The earth is located at (-mu,0) and the moon at (1-mu,0). 
% y(1) and y(3) = coordinates of the third body.
% y(2) and y(4) = velocity of the third body
%.
% Copyright (c) 1984-98 by The MathWorks, Inc.
% All Rights Reserved.

mu = 1/82.45;
mus = 1-mu;
r1 = norm([y(1)+mu, y(3)]);   % Distance to the earth
r2 = norm([y(1)-mus, y(3)]);  % Distance to the moon
yp(1) = y(2);
yp(2) = 2*y(4) + y(1) - mus*(y(1)+mu)/r1^3 - mu*(y(1)-mus)/r2^3;
yp(3) = y(4);
yp(4) = -2*y(2) + y(3) - mus*y(3)/r1^3 - mu*y(3)/r2^3;
yp = yp';

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -