image thumbnail
from binary_orbit by Dan Massie
Simulates the motion of a planet in a binary star solar system.

binary_orbit_par.m
% Binary Star / Planet simulation
% Dan Massie, 9/2003

% Modify these system parameters
NumDays = 100;          % Number of earth days in simulation
G       = 6.67e-11;     % Gravitaional constant                                     (N-m^2/kg^2)
M1      = 6.0e24;       % Mass of star 1 (on the left)                              (kg)
M2      = 6.0e24;       % Mass of star 2 (on the right)                             (kg)
m       = 0.08e24;      % Mass of planet                                            (kg)
D       = 1000e6;       % Distance between stars                                    (m)
di      = 500e6;        % Initial distance of planet from star bisec point          (m)
zetai   = pi/2;         % Initial absolute angle of planet from star bisec point    (rad)
vi      = 800;          % Initial velocity of planet                                (m/s)
phii    = 0;            % Initial absolute angle of velocity of planet              (rad)

% run the model
sim('binary_orbit');

% plot the stars and the planets path
plot(-D/2,0,'o');
hold;
plot(D/2,0,'o');
plot(0,0,'+k');
plot(x,y,'r');
axis equal;
hold off;

Contact us at files@mathworks.com