% Refer to 5-48,5-49,5-50, "Matlab, Mathematic. The language of Technical % Computing". The MathWorks. 2004. Matlab7. % ORBITODE Restricted three-body problem % % The system is defined as follows: % (1) y_1'=y_3 % (2) y_2'=y_4 % (3) y_3'=2(y_4)+(y_1)-[(µ*((y_1)+µ)/(r_1)^3]-[(µ(y_1)+µ*)/(r_2)^3] % (4) y_4'=-2(y_3)+(y_2)-[µ*(y_2)/(r_1)^3]-[(µ(y_2)/(r_2)^3] % with % µ=1/82.45 % µ*=1-µ % r1=[(y_1)+µ)^2+(y_2)^2]^(1/2) % r2=[(y_1)-µ*)^2+(y_2)^2]^(1/2) tspan = [0 7]; y0 = [1.2; 0; 0 ; -1.04935750983031990726]; options= odeset('RelTol',1e-5,'AbsTol',1e-4,... 'OutputFcn',@odephas2,'Events',@events); [t,y,te,ye,ie] = ode45(@fct_tbp,tspan,y0,options); plot(y(:,1),y(:,2),ye(:,1),ye(:,2),'o'); title('Restricted three body problem') xlabel('x(t)') ylabel('y(t)') % The MathWorks, Matlab7. Copyright (c).