Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

11/22/2013

Final Project
AE 362 Orbital Mechanics

Nature uses as little as possible of anything.


Johannes Kepler

Enrique Blanco 800556905

Answer:

DISTURBED

UNDISTURBED

UNDISTURBED
x 10

Position Vector (km)

10

X
Y
Z

Velocity Vector (km/s)

2
1
0
-1
-2
0
4
x 10
5

10
15
Time (hours)

20

-5

10
15
Time (hours)

20

25

Velocity (km/s)

Position R(km)

10

4
3
2
1
0
0

-10
0

25

Vx
VY
VZ

6
4
2

10
15
Time (hours)

20

25

0
0

10
15
Time (hours)

20

25

From the figures we can easily notice how the orbit changes its position inversely with respect to its velocity
and its periodicity respectively.
3

DISTURBED

x 10

10
X
Y
Z

Position Vector (km)

Velocity Vector (km/s)

2
1
0
-1
-2
0

x 10

10
15
Time (hours)

20

-5

10
15
Time (hours)

10
15
Time (hours)

20

25

Velocity (km/s)

Position R( km)

10

4
3
2
1
0
0

-10
0

25

Xdot
Ydot
Zdot

6
4
2

10
15
Time (hours)

20

25

0
0

20

From the graphics it is not really evident how the Earths oblateness influences the satellites mechanics
but if we look closely we can notice small changes in the position and velocity. Specially near the perigee.

25

3D plot With oblateness effect

3D ORBIT PLOT
4

x 10

Z (km)

Rz (km)

x 10

-1
4

-1
4
4

2
4

x 10

0
Ry (km)

-2

x 10

0
-2

2
x 10

Rx (km)

Y (km)

0
-2

-2

x 10
X (km)

This set of 3-d plots show that the orbit of the satellite is slightly modified in a periodic fashion due to the
Earths oblateness a little bit more graphically.

-15

x 10

1.5
Change in Eccentricity (Shape)

Semi-major axis length change (km)

x 10

0.5

-0.5

-1
0
0

10
15
Time (hours)

20

25

-1.5

10
15
Time (hours)

20

25

-14

-14

x 10

x 10

Change in Right ascencion (Degrees)

Change in Inclination (Degrees)

-1

-2

1
0
-1
-2
-3
-4
-5

-3
0

10
15
Time (hours)

-15

x 10

20

-6
0

25

10
15
Time (hours)

20

25

Change in Argument of perigee (Degrees)

1.5

This set of plots show that these orbital


elements remain essentially unchanged
through the orbit, since the changes
shown are of a magnitude of 10^-15

1
0.5
0
-0.5
-1
-1.5
-2

10
15
Time (hours)

20

25

400

400

\\\\

350

350
300

Mean Anomaly (degrees)

Mean anomaly (Degrees)

300
250
200
150

250
200
150

100

100

50

50

10
15
Time (hours)

20

25

6
Time (hours)

This plot shows that the mean


anomaly does change linearly
during the orbit, because it is a
function of time.

Here it is shown that the True


anomaly is changes in a periodic
way from 0 to 360 degrees

10

12

200

6000

Change in angular momentum components (km 2/s)

0
-200

Change in energy

-400
-600
-800
-1000
-1200
-1400
-1600
-1800

10
15
Time (hours)

20

25

hX
hY
hZ

4000
2000
0
-2000
-4000
-6000
-8000
-10000
-12000

10
15
Time (hours)

20

25

These two graphs show that the Energy and the angular momentum remain constant,
respectively.

Here we note that the ground tracks of the satellite are a periodic motion, not essentially
synchronized with the Earths rotation.
7

Appendix: Matlab code


clc
clear all
disp('ORBITAL MECHANICS')
disp('INSTRUCTOR: DAERO LEE PHD')
disp('FINAL TERM PROJECT')
disp('STUDENT: Enrique Blanco, BANNER ID: 800556905')
continuar=1;
miu=3.986004e5;
re=6378;
%ORBITAL ELEMENTS FOR SIMULATION
a=26554;
%km
e=.72;
i=(63.4*pi)/180;
%radian
omega=(206.34*pi)/180;
%radian
w=(281.64*pi)/180;
%radian
theta=(78*pi)/180;
%radian
%CONSTANTS
J2=.00108248;
%journal harmonics
miu=3.986004e5;
%gravitational constant
re=6378.145;
%radius of the earth
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
while continuar==1
clc
close('all');
disp('CHOOOSE THE PROGRAM TO RUN:');
disp('1)UNPERTURBED TWO BODY EOM ');%
disp('2)PERTURBED TWO BODY EOM');%
disp('1)"rv2oe" ORBITAL ELEMENTS FROM R AND V') ;%
disp('4)"rv2oe" POSITION AND VELOCITY VECTORS R AND V FROM THE COMPUTED ORBITAL ELEMENTS');
disp('5)GROUND TRACKS @10 HOURS');%
miu=3.986004e5;
eleccion=input('');
if eleccion==3
for problem1=1;
clc
miu=3.986004e5;
;
disp('rv2oe" ORBITAL ELEMENTS FROM R AND V')
%disp('PLEASE ENTER r VECTOR COMPONENTS')
%disp('PLEASE ENTER r VECTOR I COMPONENT')
%rx=input('');
%disp('PLEASE ENTER r VECTOR J COMPONENT')
%ry=input('');
%disp('PLEASE ENTER r VECTOR K COMPONENT')
%rz=input('');
%rv=[rx ry rz]
%disp('PLEASE ENTER v VECTOR COMPONENTS')
%disp('PLEASE ENTER v VECTOR I COMPONENT')
%vx=input('');
%disp('PLEASE ENTER v VECTOR J COMPONENT')
%vy=input('');
%disp('PLEASE ENTER v VECTOR K COMPONENT')
X_vec(:,1) =1.0e+003 * [-9.981898405132919 -4.907698385326198 -0.061450236178214 -0.002288770597456 -0.004327936557806
0.005717431045229];
rv=X_vec(1:3);
r=norm(rv);
vv=X_vec(4:6);
%vz=input('');
%vv=[vx vy vz];
%r=norm(rv);
v=norm(vv);
vr = dot(rv,vv)/r;
hv=cross(rv,vv);
h=norm(hv);
i= acos((hv(3))/h);
nv=cross([0 0 1],hv);
n=norm(nv);
omega= acos((nv(1))/n);
if nv(2)<0
omega=2*pi-omega;
end
ev=(1/miu)*((((v^2)-(miu/r)).*rv)-(r*vr.*vv));
e=norm(ev);
w=acos((dot(nv,ev))/(n*e));
if ev(3)<0
w=2*pi-w;
end
%a=((h^2)/miu)*(1/(1-e^2));
ra=((h^2)/miu)*(1/(1-e));
rp=((h^2)/miu)*(1/(1+e));
a=(.5)*(ra+rp);
theta=acos((dot(ev,rv))/(r*e));
if vr<0
theta=(2*pi-theta);
end
disp('****RESULTS****');
disp(['1) SEMI-MAJOR AXIS IS ', num2str(a),'(km)'])
id=((i*180)/pi);
id;

disp(['2) INCLINATION IS ', num2str(id),''])


omegad=((omega*180)/pi);
disp(['3) ASCENDING NODE IS ', num2str(omegad),'']);
disp(['4) ECCENTRICITY IS ', num2str(e)]);
thetad=((theta*180)/pi);
disp(['5) TRUE ANOMALY IS ', num2str(thetad),'']);
wd=((w*180)/pi);
disp(['6) ARGUMENT OF PERIGEE ', num2str(wd),'']);
end
elseif eleccion==1
for problem2=1;
clc
disp('UNPERTURBED TWO BODY EOM');
p = a*(1-e*e);
r = p/(1+e*cos(theta));
rv = [r*cos(theta); r*sin(theta); 0];
vv = sqrt(miu/p)*[-sin(theta); e+cos(theta); 0];
miu=3.986e5;
T=2*pi*(a^(3/2))/(sqrt(miu));
time=[0:10:(2*T)];
for s=1; %counters
position=(zeros(1,length(time)));
deltaE=(zeros(1,length(time)));
angularm=(zeros(1,length(time)));
velocity=(zeros(1,length(time)));
axis=(zeros(1,length(time)));
omegav=(zeros(1,length(time)));
eccentricity=(zeros(1,length(time)));
argument=(zeros(1,length(time)));
inc=(zeros(1,length(time)));
Mev=(zeros(1,length(time)));
positionx=(zeros(1,length(time)));
positiony=(zeros(1,length(time)));
positionz=(zeros(1,length(time)));
velocityx=(zeros(1,length(time)));
velocityy=(zeros(1,length(time)));
velocityz=(zeros(1,length(time)));
teta=(zeros(1,length(time)));
hx=(zeros(1,length(time)));
hy=(zeros(1,length(time)));
hz=(zeros(1,length(time)));
hvx=0;
hvy=0;
hvz=0;
end
y=0;
time=0:10:(2*T);
E0=(((v^2)/2)-(miu/r));
a0=((h^2)/miu)*(1/(e^2-1));
h0=h;
wc=w;
thet0=theta;
omeg0=omega;
ic=i;
h=p;
for t=0:10:(2*T)
Me=((2*pi)/T)*t;
E=Me;
y=y+1;
e0=e;
w0=w;
i0=i;
omega0=omega;
for i=1:5
E=E-(E-e*sin(E)-Me)/(1-e*cos(E));
end
theta=acos((e-cos(E))/(e*cos(E)-1));
r=((h^2)/miu)*(1/(1+e*cos(theta)));
v=sqrt((miu/a)+(2*miu/r));
%a=((h^2)/miu)*(1/(e^2-1));
position(y)=r;
velocity(y)=v;
Rx=(((h^2)/miu)*(1/(1+e*cos(theta)))).*(vertcat(cos(theta),sin(theta),0));
Vx=(miu/h)*[-sin(theta); e+cos(theta);0];
C1=[cos(w) sin(w) 0; -sin(w) cos(w) 0; 0 0 1];
C2=[1 0 0; 0 cos(ic) sin(ic) ; 0 -sin(ic) cos(ic)];
C3=[cos(omega) sin(omega) 0; -sin(omega) cos(omega) 0; 0 0 1];
Q=C1*C2*C3;
Qt=transpose(Q);
Mev(y)=Me;
ri=Qt*Rx;
vi=Qt*Vx;
vt=(h/r);
rx=ri(1);
ry=ri(2);
rz=ri(3);
vz=vi(3);
vx=vi(1);
vy=vi(2);

positionx(y)=rx;
positiony(y)=ry;
positionz(y)=rz;
velocityx(y)=vx;
velocityy(y)=vy;
velocityz(y)=vz;
rv=[rx ry rz];
vv=[vx vy vz];
r=norm(rv);
v=norm(vv);
vr = (dot(rv,vv))/r;
hv=cross(rv,vv);
h=norm(hv);
dhx=hvx-hv(1);
dhy=hvy-hv(2);
dhz=hvz-hv(3);
hvx=hv(1);
hvy=hv(2);
hvz=hv(3);
i= acos((hv(3))/h);
nv=cross([0 0 1],hv);
n=norm(nv);
omega= acos((nv(1))/n);
if nv(2)<0
omega=2*pi-omega;
end
ev=(1/miu)*((((v^2)-(miu/r)).*rv)-(r*vr.*vv));
e=norm(ev);
w=acos((dot(nv,ev))/(n*e));
if ev(3)<0
w=2*pi-w;
end
%a=((h^2)/miu)*(1/(1-e^2));
theta=acos((dot(ev,rv))/(r*e));
%if vr<0
%theta=(2*pi-theta);
%end
incd=i-i0;
inc(y)=incd;
deltaw=w0-w;
argument(y)=deltaw;
w0=w;
deltaec=e-e0;
eccentricity(y)=deltaec;
e0=e;
semimajor=a-a0;
angularmd=h-h0;
omegaw=omega-omega0;
teta(y)=theta;
%if(mod(y,2)~=0)
%omegav(y)=-1*omegaw;
%else
omegav(y)=omegaw;
%end
angularm(y)=angularmd;
axis(y)=semimajor;
energy=(((v^2)/2)-(miu/r));
deltaE(y)=energy-E0;
E0=energy;
h0=h;
a0=a;
omega0=omega;
hx(y)=dhx;
hy(y)=dhy;
hz(y)=dhz;
end
for l=1 %GRAPHICS
g=1;
Mve=(zeros(1,length(0:10:T)));
for te=0:10:T
Mve(g)=Mev(g);
g=g+1;
end
ht=[0:10:T];
ht=ht/3600;
Mve=(Mve*180)/pi;
time=time/3600;
figure;
plot(time,hx,'b');
hold on;
grid on;
plot(time,hy,'g');
plot(time,hz,'r--');
xlabel('Time (hours)');
ylabel('Change in angular momentum components (km^2/s)');
legend('hX','hY','hZ');
hold off;
figure;
plot(time,positionx,'b');
hold on;
plot(time,positiony,'g');

10

plot(time,positionz,'r--');
xlabel('Time (hours)');
ylabel('Position r(vector) (km)');
legend('X','Y','Z');
hold off;
figure;
plot(time,velocityx,'g');
hold on;
plot(time,velocityy,'b');
plot(time,velocityz,'r--');
xlabel('Time (hours)');
ylabel('Velocity v(vector) (km/s)');
legend('Xdot','Ydot','Zdot');
hold off;
figure;
plot(time,position,'r');
xlabel('Time (hours)');
ylabel('Position r (km)');
figure;
plot(time,velocity,'g');
xlabel('Time (hours)');
ylabel('Velocity v (km/s)');
figure;
plot(ht,Mve,'b--');
xlabel('Time (hours)');
ylabel('Mean Anomaly (degrees)');
figure;
plot(time,deltaE,'b');
xlabel('Time (hours)');
ylabel('Change in energy');
figure;
plot(time,angularm,'g--');
xlabel('Time (hours)');
ylabel('Change in angular momentum');
plot(time,axis,'b--');
xlabel('Time (hours)');
ylabel('Semi-major axis length change (km)');
figure;
omegav=((omegav*180)/pi);
plot(time,omegav,'g--');
xlabel('Time (hours)');
ylabel('Change in Right ascencion (Degrees)');
figure;
plot(time,eccentricity,'b');
xlabel('Time (hours)');
ylabel('Change in Eccentricity (Shape)');
figure;
plot(time,argument,'y');
argument=((argument*180)/pi);
xlabel('Time (hours)');
ylabel('Change in Argument of perigee (Degrees)');
figure;
inc=((inc*180)/pi);
plot(time,inc,'r--');
xlabel('Time (hours)');
ylabel('Change in Inclination (Degrees)');
figure;
teta=((teta*180)/pi);
plot(time,teta,'r');
xlabel('Time (hours)');
ylabel('Mean anomaly (Degrees)');
end
end
elseif eleccion==2
disp('3)PERTURBED TWO BODY EOM');%
clc
T=2*pi*(a^(3/2))/(sqrt(miu));
time=[0:10:(2*T)];
for s=1; %counters
position=(zeros(1,length(time)));
deltaE=(zeros(1,length(time)));
angularm=(zeros(1,length(time)));
velocity=(zeros(1,length(time)));
axis=(zeros(1,length(time)));
omegav=(zeros(1,length(time)));
eccentricity=(zeros(1,length(time)));
argument=(zeros(1,length(time)));
inc=(zeros(1,length(time)));
Mev=(zeros(1,length(time)));
positionx=(zeros(1,length(time)));
positiony=(zeros(1,length(time)));
positionz=(zeros(1,length(time)));
velocityx=(zeros(1,length(time)));
velocityy=(zeros(1,length(time)));
velocityz=(zeros(1,length(time)));
end
y=0;
time=0:10:(2*T);
E0=(((v^2)/2)-(miu/r));
a0=((h^2)/miu)*(1/(e^2-1));
h0=h;
wc=w;

11

thet0=theta;
omeg0=omega;
ic=i;
for t=0:10:(2*T)
Me=((2*pi)/T)*t;
E=Me;
y=y+1;
e0=e;
w0=w;
i0=i;
omega0=omega;
for i=1:5
E=E-(E-e*sin(E)-Me)/(1-e*cos(E));
end
theta=acos((e-cos(E))/(e*cos(E)-1));
r=((h^2)/miu)*(1/(1+e*cos(theta)));
v=sqrt((miu/a)+(2*miu/r));
position(y)=r;
velocity(y)=v;
Rx=(((h^2)/miu)*(1/(1+e*cos(theta)))).*(vertcat(cos(theta),sin(theta),0));
Vx=(miu/h)*[-sin(theta); e+cos(theta);0];
C1=[cos(w) sin(w) 0; -sin(w) cos(w) 0; 0 0 1];
C2=[1 0 0; 0 cos(ic) sin(ic) ; 0 -sin(ic) cos(ic)];
C3=[cos(omega) sin(omega) 0; -sin(omega) cos(omega) 0; 0 0 1];
Q=C1*C2*C3;
Qt=transpose(Q);
Mev(y)=Me;
ri=Qt*Rx;
vi=Qt*Vx;
vt=(h/r);
rx=ri(1);
ry=ri(2);
rz=ri(3);
vz=vi(3);
vx=vi(1);
vy=vi(2);
aJ2x =1/2*miu*J2*re^2*(15*vx*vz^2/r^7-3*vx/r^5);
aJ2y = 1/2*miu*J2*re^2*(15*vy*vz^2/r^7-3*vy/r^5);
aJ2z = 1/2*miu*J2*re^2*(15*vz^3/r^7-9*r/r^5);
ax = -miu*vx/r^3+aJ2x;
ay = -miu*vy/r^3+aJ2y;
az = -miu*vz/r^3+aJ2z;
X_vec_dot_J2 = [vx vy vz ax ay az];
accv=[ax ay az];
k1=0;
k2=0;
k3=0;
k4=0;
cont=.1;
for x=0:cont:xf
x1=x;
y0=y;
k1=subs(f);
x=x+(1/2)*h;
x0=x;
y=y+(1/2)*k1;
k2=h*subs(f);
y=y0;
y=y+(1/2)*k2;
k3=h*subs(f);
y=y0;
y=y+k3;
x=x0+h;
k4=h*subs(f);
y=y0+(1/6)*(k1+2*k2+2*k3+k4)
x=x1;
end
positionx(y)=rx;
positiony(y)=ry;
positionz(y)=rz;
velocityx(y)=vx;
velocityy(y)=vy;
velocityz(y)=vz;
rv=[rx ry rz];
vv=[vx vy vz];
r=norm(rv);
v=norm(vv);
vr = (dot(rv,vv))/r;
hv=cross(rv,vv);
h=norm(hv);
i= acos((hv(3))/h);
nv=cross([0 0 1],hv);
n=norm(nv);
omega= acos((nv(1))/n);
if nv(2)<0
omega=2*pi-omega;
end
ev=(1/miu)*((((v^2)-(miu/r)).*rv)-(r*vr.*vv));
e=norm(ev);
w=acos((dot(nv,ev))/(n*e));

12

if ev(3)<0
w=2*pi-w;
end
a=((h^2)/miu)*(1/(1-e^2));
theta=acos((dot(ev,rv))/(r*e));
if vr<0
theta=(2*pi-theta);
end
incd=i-i0;
inc(y)=incd;
deltaw=w0-w;
argument(y)=deltaw;
w0=w;
deltaec=e-e0;
eccentricity(y)=deltaec;
e0=e;
semimajor=a-a0;
angularmd=h-h0;
omegaw=omega-omega0;
%if(mod(y,2)~=0)
%omegav(y)=-1*omegaw;
%else
omegav(y)=omegaw;
%end
angularm(y)=angularmd;
axis(y)=semimajor;
energy=(((v^2)/2)-(miu/r));
deltaE(y)=energy-E0;
E0=energy;
h0=h;
a0=a;
omega0=omega;
end
for l=1 %GRAPHICS
g=1;
Mve=(zeros(1,length(0:10:T)));
for te=0:10:T
Mve(g)=Mev(g);
g=g+1;
end
ht=[0:10:T];
ht=ht/3600;
Mve=(Mve*180)/pi;
time=time/3600;
figure;
plot(time,positionx,'b');
hold on;
plot(time,positiony,'g');
plot(time,positionz,'r--');
xlabel('Time (hours)');
ylabel('Position r(vector) (km)');
legend('X','Y','Z');
hold off;
figure;
plot(time,velocityx,'g');
hold on;
plot(time,velocityy,'b');
plot(time,velocityz,'r--');
xlabel('Time (hours)');
ylabel('Velocity v(vector) (km/s)');
legend('Xdot','Ydot','Zdot');
hold off;
figure;
plot(time,position,'r');
xlabel('Time (hours)');
ylabel('Position r (km)');
figure;
plot(time,velocity,'g');
xlabel('Time (hours)');
ylabel('Velocity v (km/s)');
figure;
plot(ht,Mve,'b--');
xlabel('Time (hours)');
ylabel('Mean Anomaly (degrees)');
figure;
plot(time,deltaE,'b');
xlabel('Time (hours)');
ylabel('Change in energy');
figure;
plot(time,angularm,'g--');
xlabel('Time (hours)');
ylabel('Change in angular momentum');
plot(time,axis,'b--');
xlabel('Time (hours)');
ylabel('Semi-major axis length change (km)');
figure;
omegav=((omegav*180)/pi);
plot(time,omegav,'g--');
xlabel('Time (hours)');
ylabel('Change in Right ascencion (Degrees)');
figure;
plot(time,eccentricity,'b');
xlabel('Time (hours)');

13

ylabel('Change in Eccentricity (Shape)');


figure;
plot(time,argument,'y');
argument=((argument*180)/pi);
xlabel('Time (hours)');
ylabel('Change in Argument of perigee (Degrees)');
figure;
figure;
inc=((inc*180)/pi);
plot(time,inc,'r--');
xlabel('Time (hours)');
ylabel('Change in Inclination (Degrees)');
end
for problem3=3
end
elseif eleccion==4
clc
disp('"oe2rv" ORBITAL ELEMENTS TO R AND V VECTORS');
Rx=(((h^2)/miu)*(1/(1+e*cos(theta)))).*(vertcat(cos(theta),sin(theta),0));
Vx=(miu/h)*[-sin(theta); e+cos(theta);0];
C1=[cos(w) sin(w) 0; -sin(w) cos(w) 0; 0 0 1];
C2=[1 0 0; 0 cos(i) sin(i) ; 0 -sin(w) cos(w)];
C3=[cos(omega) sin(omega) 0; -sin(omega) cos(omega) 0; 0 0 1];
Q=C1*C2*C3;
Qt=transpose(Q);
ri=Qt*Rx;
vi=Qt*Vx;
vt=(h/r);
Mev(y)=Me;
rx=ri(1);
ry=ri(2);
rz=ri(3);
vx=vi(1);
vy=vi(2);
vz=vi(3);
rv=[rx ry rz];
vv=[vx vy vz];
disp(['5) R VECTOR IS ', num2str(rv),'km']);
disp(['6) VELOCITY VECTOR IS ', num2str(vv),'km/s']);
elseif eleccion==5
for problem5=1;
disp('GROUND TRACKS @10 HOURS');
function [h] = Groundtrack(Kepler,GMSTo,Tf,fig,dT,s,mu)
h = 0;
r2d = 180/pi; %Radians to degrees conversion
w_earth = 7.2921158553e-5; %rad/s %Rotation rate of Earth
if nargin < 3 || nargin > 7
error('Incorrect number of inputs, see help groundtrack.m')
elseif nargin == 3
h = figure;
dT = 60;
s
= 'b';
mu = 398600.4415;
%km^3/s^2 Gravitational constant of
elseif nargin == 4
s = 'b';
dT = 60;
s
= 'b';
mu = 398600.4415;
%km^3/s^2 Gravitational constant of
elseif nargin == 5
s
= 'b';
mu = 398600.4415;
%km^3/s^2 Gravitational constant of
elseif nargin == 6
mu = 398600.4415;
%km^3/s^2 Gravitational constant of
end

Earth

Earth
Earth
Earth

if h == 0
h = figure(fig);
end
a
ecc
inc
O
w
nuo

=
=
=
=
=
=

Kepler(1);
Kepler(2);
Kepler(3);
Kepler(4);
Kepler(5);
Kepler(6);

n = (mu/a^3)^.5;

%Mean motion of satellite

E = atan2(sin(nuo)*(1-ecc^2)^.5,ecc+cos(nuo));
MA = E-ecc*sin(E); %Initial Mean anomaly

%Eccentric anomaly

time = [0:dT:Tf]; %time vector


bp(1)
bp(2)
k
Lat_rad
Long_rad

=
=
=
=
=

0;
length(time);
2;
zeros(1,length(time));
zeros(1,length(time));

14

for j = 1:length(time)
GMST = zeroTo360(GMSTo + w_earth*time(j),1);
M = zeroTo360(MA + n*time(j),1);
nu = nuFromM(M,ecc,10^-12);

%GMST in radians

%Mean anomaly in rad


%True anomaly in rad

[ECI,Veci] = randv(a,ecc,inc,O,w,nu);
clear veci
ECEF = eci2ecef(ECI,GMST);
[Lat_rad(j),Long_rad(j)] = RVtoLatLong(ECEF);
if j > 1 && ((Long_rad(j)-Long_rad(j-1)) < -pi || (Long_rad(j)-Long_rad(j-1)) > pi)
bp(k) = j-1;
k
= k+1;
end
end
bp(length(bp)+1) = length(time);
Lat
= Lat_rad.*r2d;
Long
= Long_rad.*r2d;
x = load('Coastline.dat');
plot(x(:,1),x(:,2),'r--')
clear x
hold on
for j = 2:length(bp)
plot(Long(bp(j-1)+1:bp(j)),Lat(bp(j-1)+1:bp(j)),s)
end
axis([-180,180,-90,90])
xlabel('Longitude (\circ)')
ylabel('Latitude (\circ)')
end

end

continuar=input('WOULD YOU LIKE TO RUN ANOTHER PROGRAM? YES=1 NO=0


clc
end

15

');

You might also like