function twobody_script(T,V0,b)
% Script to model Two Body problem
% Input values T and b are Time for orbit 
%   and Relative Tolerance,% respectively
% Initial Conditions for 2 masses:
% Mass 1 location: (1,0)
% Mass 1 velocity: <V0(1),V0(2)>
% Mass 2 location: (-1,0)
% Mass 2 velocity: <V0(3),V0(4)>

% Options to set absolute and relative tolerance levels
% options default: 'AbsTol',1e-6,'RelTol',1e-3
options = odeset('AbsTol',1e-6,'RelTol',b);

% Runge Kutta 4-5 method with options
%x=[x1,u1,x2,u2,y1,v1,y2,v2]
[t,x]=ode45('twobody',[0:0.01:T],[1.0,V0(1),-1.0,V0(3),0,V0(2),0,V0(4)],options);

% uncomment the next line for terminal printing ...
figure;close;
plot(x(:,1),x(:,5),x(:,3),x(:,7));
axis ([-3 3 -3 3]);

%Apply Lables and Title
XLABEL('x');
YLABEL('y');
TITLE(['2-Body System: mass1_0=(-1,0) ; mass2_0=(1,0) ; T=',num2str(T),' relative tol=', num2str(b)]);

name = ['twobody_T=',num2str(T),'tolerance=',num2str(b),'.jpg'];
%uncomment to pring jpg
%print ('-djpeg(100)', name)



