my_yprime_m.m

来自「该程序为MATLAB对CDMA系统个部分的仿真」· M 代码 · 共 25 行

M
25
字号
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 + =
减小字号Ctrl + -
显示快捷键?