Commit 7aeb9aa5 authored by aelkawas's avatar aelkawas
Browse files

Sim files and calculations

parent c10409d2
Re = 6378;
mu = 398600.4;
a_p = 638+Re;%parking orbit
a_Leo = 550+ Re;
a_Geo = 35786 +Re;
i_p = 46 *pi/180; %average inclnation
i_geo = 0;
i_leo = 53* pi/180;
A = 0.00001; %Based on thrusters
deltaT = -sqrt(mu)/(A*sqrt(a_p)) + sqrt(mu)/(A*sqrt(a_Leo))
deltaV = A*deltaT; %km/hr
deltaTHours = deltaT/(3600);
deltaTDays = deltaT/(24*3600);
\ No newline at end of file
Re = 6378;
mu = 398600.4;
R0 = [-8.058685464116713e+002;...
-4.135050989428283e+003;...
5.071447347723579e+003];
V0 = [6.04068079277917;
3.52422658592595;
3.83339310219652];
X0 = [R0; V0];
t0 = 0;
tstep = 20;
tfinal = 96.2*60*5;
tspan = t0: tstep: tfinal;
options = odeset('AbsTol', 1e-6, 'RelTol', 1e-8);
[Tp, Xp] = ode45(@newton, tspan, X0, options);
figure(1); hold off;
plot3(Xp(:,1), Xp(:,2), Xp(:,3), 'g-', 'linewidth', 3);
xlabel('x (km)');
ylabel('y (km)');
zlabel('z (km)');
[XS, YS, ZS] = sphere(30);
figure(1);
hold on;
surf(XS*Re, YS*Re, ZS*Re);
axis([-1e4, 1e4, -1e4, 1e4, -1e4, 1e4]);
figure(2);
plot(Tp, sqrt(Xp(:,1).^2 + Xp(:,2) + Xp(:,3).^2) - Re,'linewidth', 3);
ylabel('h = r-R_e (km)')
xlabel ('t (sec)')
function Xdot = newton(t, X)
mu = 398600.4405;
r= X(1:3);
v = X(4:6);
Xdot(1:3) = v;
rn = norm(r);
Xdot(4:6) = -mu/rn^3*r;
Xdot = Xdot(:);
return;
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment