Académique Documents
Professionnel Documents
Culture Documents
Observation:
SPE 510 Midterm Report
Kelvin Loh (20114534)
Room 3333, Department Of Aerospace Engineering
KAIST
kklloh@kaist.ac.kr
March 31, 2012
Abstract
A suite of MATLAB functions are developed to analyze the Walker-Delta Constellation. Since this is one of the more popular constellations, two cases are
also being thought out to determine if the constellation pattern can be a solution for the cases that require extensive Earth observation. It is shown that
the constellation is sensitive to altitude changes.
Introduction
K. Loh
Theoretical Models
This section covers the theoretical basis for the codes used to evaluate the performances of the Walker-Delta constellation to cover a target on Earth for observation.
Proofs of the models used are not provided in this report.
2.1
The two-body equation of motion, namely, Newtons second law and his universal
law of gravitation form the starting point for any study of astrodynamics. Equation
1 describes the motion of a body (satellite) of negligible mass with respect to another
body (Earth) under the influence of a gravitational force. This then assumes that an
inertial frame of reference can be centered at the barycenter of the massive body.
~r
(1)
~r = 2
r r
In Newtons law of gravitation, the gravitational force can be expressed in terms
of the gradient of a scalar gravitational potential function of a body. For a
spherical body
(2)
F~ = =
r
For a non-spherical body, can contain additional terms which can be used to
determine F~ , and subsequently ~r. As the inertial reference frame is centered at the
center of the massive body, Equation 1 is also known as the fundamental equation
of relative two-body motion. The MATLAB function orbit.m uses this equation to
determine the satellite motion.
2.2
Keplers laws are derived from Equation 1. The orbital position as a function of
time can be decribed by the mean anomaly, Me . The propagation routines used
in the codes ground track2.m and satellite constellation.m are based on solving the
Keplers equation (Equation 3) for each time step.
Me = E e sin (E)
where E is the eccentric anomaly, and e is the eccentricity.
(3)
3
2
1 e2 2 t
3
h
(4)
2.3
Orbit Perturbations
Equation 1 assumes that the revolving body experiences forces only from the central
body. However, this assumption does not hold for actual orbits. In reality, there are
many perturbations to the orbital motion. The equation can then be generalized to
include all the other perturbation forces acting on the body as described by Equation
6.
~r
~r = 2 + ~ap
(6)
r r
As the Earth is not a perfect sphere, the gravitational potential will deviate from
that of a perfect sphere. Due to this effect, the orbital motion will encounter perturbations. This project considers the effects of Earth Gravity Harmonics mainly, the
J2 perturbation on the secular rates of the right ascension of ascending node (),
the argument of perigee (p ), and a small correction to the mean motion of the orbit
(M e ). The rates are computed by the following equations:
2
3 J2 RE
=
n
cos i
2 p2
2
3 J2 RE
5 2
p =
n
2 sin i
2 p2
2
r
2
3
J
R
3
2
E
2
M e = n
=
1+
1 sin i
1 e2
a30
2 p2
2
(7)
(8)
(9)
K. Loh
with the symbols taking their usual notations. Atmospheric drag perturbation effects
was not included in the simulations since it is assumed that the main propulsion system onboard a satellite will perform the necessary station-keeping maneuvers during
the mission.
For the special perturbation method employed in orbit.m, Cowells method [2]
was used. From Equation 2, it is seen that the gravitational force acting on the
revolving body can be described by the gradient of a potential function. From this,
the potential theory provides a clear picture of the gravity harmonics of the Earth.
The potential function for the primary body due to the J2 perturbation is described
by Equation 10 in the inertial Cartesian coordinate frame (ECI).
1
J2
=
r 2
RE
r
2
z 2
13
r
(10)
p
where r = x2 + y 2 + z 2
It can then be derived from Equation 10 and Equation 2 that
~aJ2
z 2 y
z 2 z
z 2 >
2
x
3 J2 RE
15
,
15
,
35
=
2 r4
r
r
r
r
r
r
(11)
The acceleration ~aJ2 is then added to the right-hand side of Equation 6 as part of the
perturbation acceleration.
2.4
Earth Coverage
This section will only reference figures from the text used [3] to compute the Earth
target coverage by a satellite. Also, the programs assume that for coverage purposes,
the Earth is a perfect sphere. An area access coordinate frame on the Earths surface
is defined corresponding to the nadir coordinate frame of the spacecraft. Figure 9-2
of the text [3] shows the definition of the access area coordinate frame. The transformation between latitude and longitude and access area coordinates is relatively
straightforward.
For the programs, the maximum Earth Central Angle is given by,
RE
(12)
RE + H
However, to account for the optical sensor resolution, the Earth central angle is
limited by the resolution requirements (Figure 9-3 of the text [3]). From the Rayleigh
0 =
(13)
(14)
The transformation from the latitude and longitude of the target (P) and subsatellite point (SSP) (Figure 9-4 of the text [3])are as follows:
Lat0P = 90 LatP , Lat0SSP = 90 LatSSP
(15)
L = LongSSP LongP
(16)
rP = cos1 [cos Lat0P cos Lat0SSP + sin Lat0P sin Lat0SSP cos L]
(17)
The target will be observable from the spacecraft optical payload if rP min(0 , )
2.5
Walker-Delta constellation
The most symmetric of the satellite patterns is the Walker Constellation. The WalkerDelta Pattern contains a total of T satellites with S satellites evenly distributed
in each of P orbit planes. All of the orbit planes are assumed to be at the same
inclination, i, relative to the equator. The ascending nodes of the P orbit planes
in Walker patterns are uniformly distributed around the equator at intervals of 360
.
P
Within each orbital plane, the S satellites are uniformly distributed at intervals of
360
. The phase difference, , in a constellation is defined as the angle in the
S
direction of motion from the ascending node to the nearest satellite at a time when
a satellite in the next most westerly plane is at its ascending node. must be an
Several MATLAB functions (mainly, optim main.m, ground track2.m, orbit.m, and
test t.m) were written to analyze the behaviour of the Walker-Delta constellation.
K. Loh
The ground track2.m function was written as a tool to test the orbit propagator
(satellite constellation.m) for a perturbed Keplerian orbit used in optim main.m as
well as to visualize the final design parameter chosen for the observation of KAIST.
In general the basic structure of the codes are similar to each other. The first section will be the inputs of the simulation, second function will initialize the spacecraft
state vectors in the ECI (SV) or in the Keplerian orbit elements (COE). After that
each satellite in the constellation are propagated along the same rates, hence, for
the constellation, only the initial condition is important. After the SVs or COEs
are known at each time step from the propagator, the position of the satellites
are then converted into the Earth latitude and longitude coordinate frame. In the
find ra and dec function, this is being done. This makes it easier to obtain the
subsatellite point latitudes and longitudes for coverage determination.
The appendix lists the important codes. The optim main.m code is a wrapper code
which can brute force calculate potentially all the design variables of the Walker-Delta
constellation. It uses the MATLAB parallel toolbox for independent design variable
computations.
Validation cases
There currently are no test cases to be compared against. However, the author
believes that if the individual functions are working and tested, the results after the
functions are combined can be reliable.
4.1
The first test is the satellite initialization subroutine. The output in Figure 2 shows
that the initialization was done correctly. The orbit was also propagated correctly
with all the outputs showing that the satellites were uniformly propagated. The
final output is shown in Figure 3. Table 1 presents the results of a single satellite
using different propagator models. One is run using orbit.m and the other using
ground track2.m. As can be seen, the results show not a large difference between
the RK5 and Kepler propagator model, with the exception that the Kepler model is
faster to run but the disadvantage is that it assumes an elliptical orbit.
K. Loh
4.2
Earth coverage
Unfortunately, there is no known standard test case to be run for the calculation of
the earth coverage.
4.3
Figure-of-Merit
The calculation of the coverage FOM by the subroutine test t.m is particularly important to establish the performance of the design of the constellation. Hence the
percentage coverage and mean response time calculations must be validated. For the
test case, the observation patterns for case A is reproduced with varying number of
timesteps for the same length. The first is that shown by the text [3] with dt = 1
time unit. The second case gives a dt = 0.1 time unit. The third case gives dt = 0.01
time unit.
The percent coverage and mean response time matches well with the FOM given
out by the text (Page 485 in [3]). When the time steps are refined, however, the
mean response time differs by quite a significant value. The second case A with a
finer time step of 0.1 time unit, gives a mean response time of 0.32 time unit instead
of 0.5 as quoted by the text. Figures 4 to 6 show the case A observation histogram
with increasingly finer timesteps.
The third case A with the finest time step of 0.01 time unit gave a mean response
time of 0.302 time unit with a percent coverage of 60%. Figure 7 shows the results
from the test t.m for the mean response time as a function of dt. It shows that
the actual mean response time as dt gets closer to 0 is 0.3 time unit instead of the
given 0.5 by the text. However, after reading up on the text and checking the code
10
K. Loh
several times, the author believes that the way to calculate the mean response time
by the subroutine test t.m was correct and attributes the difference in the results by
temporal refinement issues.
5
5.1
Patna is the capital of the Indian state Bihar. It is situated at 25.611 N, and 85.144
E. It is a growing state in India therefore, there is a need for remote sensing from
space to help city planners in building the city. As such, this case serves as a first
test for both the code and also the idea of having remote sensing satellites to aid in
city planning. The requirements are laid out such that a ground resolution is no more
than 5 m. Also, the number of satellites should be no more than 10.
The design chosen to test is a Walker-Delta constellation of 26:10/5/1. The altitude is given at 1000 km. The percent coverage obtained for a 24 hour simulation was
48.3% and the mean response time was shown to be 33.1 s with a maximum response
time of 419.9 s. Figures 8 to 10 shows the constellation configuration along with the
orbit, ground track, and the observation histogram for a single revolution.
5.2
KAIST is South Koreas first research oriented science and engineering institution.
Naturally, as South Koreas foremost center for strategic research and development,
11
12
K. Loh
13
14
K. Loh
Figure 12: Contour map of percent coverage as a function of altitude and number of
satellites
Figure 13: Contour map of percent coverage as a function of altitude and number of
planes
15
16
K. Loh
Figure 17: Observation histogram for the constellation observing KAIST in 1 period
17
Summary
A suite of MATLAB functions was developed to analyze the behaviour of WalkerDelta Constellations. Two propagator models were compared, and both models considered the oblateness of the Earth (J2 perturbation effects). The functions were
validated and the functions were used to analyze the performance of such constellations in observing primarily, KAIST, and Patna. The results show that the design
requirements are quite tight for the KAIST case while the imaginary Patna case seem
to be feasible.
Acknowledgments
The author is grateful to Prof. Ahn Jaemyung for his lectures and out-of-class technical discussion which were necessary to complete this project. The author acknowledges the use of the algorithms as structured by one of the text used [1].
References
[1] Curtis, H. Orbital Mechanics for Engineering Students, 2nd Ed. (Elsevier Ltd,
Oxford, UK, 2010).
[2] Chobotov, V. Orbital Mechanics, 2nd Ed. (AIAA Education Series, Reston, VA,
USA 1996).
[3] Wertz, J. Mission Geometry: Orbit and Constellation Design and Management,
1st Ed. (Space Technology Library, Microcosm Press, CA, USA, 2001).
A
1
2
3
4
5
6
7
8
9
18
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
K. Loh
i n c l w = 60 deg ; %I n c l i n a t i o n o f t h e p l a n e s
Nsat = 1 : 3 0 ; %t t o t a l number o f s a t e l l i t e s
Nplane = Nsat ; %p t o t a l number o f p l a n e s
f = 1 ; %f p ha s e m u l t i p l i e r
% . . . Seed / F i r s t s a t e l l i t e p a r a m e t e r s
Alt = 4 0 0 ;
hP1 = Alt ;
hA1 = Alt ;
TAo1 = 0 deg ;
Woi = ( 0 : 5 : 3 6 0 ) deg ;
wpo1 = 0 deg ;
%Case S i m u l a t i o n l e n g t h and t i m e s t e p s
dt = 2 0 ;
to = 0 ;
t f = 1 2 4 3 6 0 0 ; % Ts i n a s s i g n m e n t paper
%T a r g e t l a t i t u d e and l o n g i t u d e
l a t T = 3 6 . 3 7 2 deg ; %3 6 . 3 7 2 deg ;
longT = 1 2 7 . 3 6 3 deg ; %1 2 7 . 3 6 3 deg ;
%S a t e l l i t e p a y l o a d p a r a m e t e r s
Da = 1 ;
WL = 5 e 7;
x res = 1.1;
KA = 2 0 6 2 6 . 4 8 0 6 ; % f o r IAA area i n deg 2
f o r k = 1 : length ( Nsat )
p a r f o r i = 1 : length ( Woi ) %Change p a r f o r t o f o r i f no p a r a l l e l
toolbox is installed
[ t SEE ] = s a t e l l i t e c o n s t e l l a t i o n (mu, J2 , Re , we , i n c l w , Nsat ( k ) ,
Nplane ( k ) , f , hP1 , hA1 , TAo1 , Woi ( i ) , wpo1 , dt , to , t f , latT , longT , Da ,
WL, x r e s ,KA) ;
[ p c o v e r ( k , i ) m e a n r e s p o n s e ( k , i ) m a x r e s p on s e ( k , i ) ] = t e s t t (SEE
,t);
% f p r i n t f ( \ n A l t i t u d e = %g km | P e r c e n t a g e c o v e r a g e = %g
p e r c e n t | Mean r e s p o n s e time = %g s e c o n d s | Max r e s p o n s e
time = %g s e c o n d s \n , A l t ( i ) , p c o v e r 100 , mean response ,
m ax r es p on s e )
drawnow ;
end
end
19
45
46 m a t l a b p o o l c l o s e ; %Comment o u t i f no p a r a l l e l t o o l b o x i n s t a l l e d
47
48 c o n t o u r f ( Woi , Nsat , p c o v e r 1 0 0 , k ) ;
1 %
2 function [ t X] = s a t e l l i t e c o n s t e l l a t i o n (mu, J2 , Re , we , i n c l w , Nsat , Nplane , f
, hP1 , hA1 , TAo1 , Woi , wpo1 , dt , to , t f , latT , longT , Da ,WL, x r e s ,KA)
3 %
4
5 %c l e a r a l l ; c l o s e a l l ; c l c
6 global r a dec n c u r v e s RA Dec
7 %m a t l a b p o o l ( 4 ) %Only used i f p a r a l l e l t o o l b o x i s i n s t a l l e d
8 deg = pi / 1 8 0 ;
9 hours = 3600;
10 %C a l c u l a t e P a t t e r n Unit f o r Walker c o n s t e l l a t i o n
11 PU = 360 deg / Nsat ;
12 %C a l c u l a t e Number o f s a t e l l i t e s i n a p l a n e
13 NSsat = Nsat / Nplane ;
14 %Angle d i v i s i o n b e t w e e n s a t e l l i t e s i n t h e p l a n e
15 beta = PU Nplane ;
16 %RAAN s p a c i n g
17 dRAAN = PU NSsat ;
18 % . . . Seed / F i r s t s a t e l l i t e p a r a m e t e r s
19 hP ( 1 : Nsat ) = hP1 ;
20 hA ( 1 : Nsat ) = hA1 ;
21 rP1 = hP1 + Re ; rP ( 1 : Nsat ) = rP1 ;
22 rA1 = hA1 + Re ; rA ( 1 : Nsat ) = rA1 ;
23 i n c l 1 = i n c l w ; i n c l ( 1 : Nsat ) =i n c l 1 ;
24 TAo ( 1 : Nsat ) = TAo1 ;
25 Wo1 ( 1 : Nsat ) = Woi ;
26 wp ( 1 : Nsat ) = wpo1 ;
27
28 f p r i n t f ( I n i t i a l s a t e l l i t e c o n s t e l l a t i o n p r o p e r t i e s \n )
29 f o r i =1: Nsat
30
pindex ( i ) = c e i l ( i / NSsat ) ;
31
Spindex ( i ) = i ( pindex ( i ) 1 ) NSsat 1 ;
32
f s a t i n d e x ( i ) = abs(1 sign ( Spindex ( i ) ) ) ;
33
TAo( i ) = TAo1 + Spindex ( i ) beta + ( pindex ( i ) 1) f PU;
20
K. Loh
34
W( i ) = Wo1( i ) + ( pindex ( i ) 1 ) dRAAN;
35 end
36
37 %C a l c u l a t e Earth c e n t r a l a n g l e from p a y l o a d p a r a m e t e r s
38 h prime = Da x r e s 1 e 3/(2.440WL) ; %From R a y l e i g h o p t i c a l r e s o l u t i o n (
km)
39 % . . . End d a t a d e c l a r a t i o n
40
41 % . . . Compute t h e r a t e s o f node r e g r e s s i o n and p e r i g e e advance
42 a = ( rA + rP ) / 2 ; %1 : Nsat
43 T = 2 pi / sqrt (mu) . a . ( 3 / 2 ) ; %1 : Nsat
44 e = ( rA rP ) . / ( rA + rP ) ; %1 : Nsat
45 h = sqrt (mu. a . ( 1 e . 2 ) ) ; %1 : Nsat
46 Eo = 2 atan ( tan (TAo/ 2 ) . sqrt ((1 e ) ./(1+ e ) ) ) ; %1 : Nsat
47 M = Eo e . sin ( Eo ) ; %1 : Nsat
48 P = a .(1 e . 2 ) ;
49 f a c = 3/2 J2 ( Re . / P) . 2 ;
50 Mdot = ( 2 pi . /T) . ( 1 + f a c . sqrt (1 e . 2 ) . ( 1 ( 3 / 2 ) . sin ( i n c l ) . 2 ) ) ; %
From Chobotov
51 Wdot = Mdot . f a c . cos ( i n c l ) ;
52 wpdot = f a c . Mdot.( 5/2 sin ( i n c l ) . 2 + 2 ) ;
53
54
55 % f o r i =1: Nsat
56 %
f p r i n t f ( \ n Sat # = %d , h = %g km , i = %g deg , Wo = %g deg ,
wpo = %g deg , TAo = %g deg , Mo = %g deg \n , i , hP( i ) , i n c l ( i ) / deg ,
W( i ) / deg , wp ( i ) / deg , TAo( i ) / deg , M( i ) / deg ) ;
57 % end
58 t i m e s=t o : dt : t f ;
59 r a ( 1 : length ( t i m e s ) , 1 : Nsat ) = 0 ;
60 dec ( 1 : length ( t i m e s ) , 1 : Nsat ) = 0 ;
61 t h e t a = 0 ;
62 r r e l m a g ( 1 : length ( t i m e s ) , 1 : Nsat ) = 0 ;
63 f o r i = 1 : length ( t i m e s )
64
t ( i ) = times ( i ) ;
65
f o r i i = 1 : Nsat
66
M( i i ) = M( i i ) + Mdot ( i i ) dt ;
67
E( i i ) = k e p l e r E ( e ( i i ) ,M( i i ) ) ;
68
TA( i i ) = 2 atan ( tan (E( i i ) / 2 ) sqrt ((1+ e ( i i ) ) /(1 e ( i i ) ) ) ) ;
69
r = h ( i i ) 2/mu/ ( 1 + e ( i i ) cos (TA( i i ) ) ) [ cos (TA( i i ) ) sin (TA( i i ) ) 0 ] ;
70
71 W( i i ) = W( i i ) + Wdot( i i ) dt ;
21
22
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
end
end
SEE( i , Nsat +1) = sign (sum(SEE( i , 1 : Nsat ) ) ) ; %As l o n g as t h e r e i s one
s a t e l l i t e c o v e r e d , t h e n t h e t a r g e t i s c o v e r e d by t h e
constellation
end
% form separate curves
% plot ground track
% print orbital data
% f i g u r e (3)
% p l o t ( t / hours , SEE ( : , Nsat +1) , k ) ;
X = SEE ( : , Nsat +1) ;
%[ p c o v e r mean response ma x r es p on s e ] = t e s t t (SEE ( : , Nsat +1) , t ) ;
% f i g u r e (4)
% p l o t ( t / hours , a l t , k ) ;
%r e t u r n
end %g r o u n d t r a c k
%
C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
K. Loh
%
function g r o u n d t r a c k 2
%
clear a l l ; close a l l ; clc
global r a dec n c u r v e s RA Dec
%m a t l a b p o o l ( 4 ) %Only used i f p a r a l l e l t o o l b o x i s i n s t a l l e d
deg = pi / 1 8 0 ;
hours = 3600;
mu = 3 9 8 6 0 0 ;
J2 = 0 . 0 0 1 0 8 2 6 3 ;
Re = 6 3 7 8 ;
we = ( 2 pi + 2 pi / 3 6 5 . 2 6 ) / ( 2 4 3 6 0 0 ) ;
%Walker c o n s t e l l a t i o n d e s i g n v a r i a b l e s
i n c l w = 60 deg ; %I n c l i n a t i o n o f t h e p l a n e s
Nsat = 3 0 ; %t t o t a l number o f s a t e l l i t e s
Nplane = 5 ; %p t o t a l number o f p l a n e s
f = 1 ; %f p ha s e m u l t i p l i e r
23
%C a l c u l a t e P a t t e r n Unit f o r Walker c o n s t e l l a t i o n
PU = 360 deg / Nsat ;
%C a l c u l a t e Number o f s a t e l l i t e s i n a p l a n e
NSsat = Nsat / Nplane ;
%Angle d i v i s i o n b e t w e e n s a t e l l i t e s i n t h e p l a n e
beta = PU Nplane ;
%RAAN s p a c i n g
dRAAN = PU NSsat ;
%A l t i t u d e ( i n km)
H = 400;
%L o n g i t u d e o f t h e f i r s t s a t e l l i t e i n t h e f i r s t p l a n e a t t =0
Lon0 = 0 ;
% . . . Seed / F i r s t s a t e l l i t e p a r a m e t e r s
hP1 = H; hP ( 1 : Nsat ) = hP1 ;
hA1 = H; hA ( 1 : Nsat ) = hA1 ;
rP1 = hP1 + Re ; rP ( 1 : Nsat ) = rP1 ;
rA1 = hA1 + Re ; rA ( 1 : Nsat ) = rA1 ;
i n c l 1 = i n c l w ; i n c l ( 1 : Nsat ) =i n c l 1 ;
TAo1 = 0 deg ; TAo ( 1 : Nsat ) = TAo1 ;
Wo1 = Lon0 deg ; Wo1 ( 1 : Nsat ) = Wo1 ;
wpo1 = 0 deg ; wp ( 1 : Nsat ) = wpo1 ;
initialize walker
dt = 2 0 ;
%T a r g e t l a t i t u d e and l o n g i t u d e ( on t h e ground )
l a t T = 3 6 . 3 7 2 deg ;%2 5 . 6 1 1 deg ;%
longT = 1 2 7 . 3 6 3 deg ;%8 5 . 1 4 4 deg ;%
%S a t e l l i t e p a y l o a d p a r a m e t e r s
Da = 1 ;
WL = 5 e 7;
x res = 1.1;
KA = 2 0 6 2 6 . 4 8 0 6 ; % f o r IAA area i n deg 2
%C a l c u l a t e Earth c e n t r a l a n g l e from p a y l o a d p a r a m e t e r s
h prime = Da x r e s 1 e 3/(2.440WL) ; %From R a y l e i g h o p t i c a l r e s o l u t i o n (
km)
52 % . . . End d a t a d e c l a r a t i o n
53
54 % . . . Compute t h e r a t e s o f node r e g r e s s i o n and p e r i g e e advance
55 a = ( rA + rP ) / 2 ; %1 : Nsat
56 T = 2 pi / sqrt (mu) . a . ( 3 / 2 ) ; %1 : Nsat
57 e = ( rA rP ) . / ( rA + rP ) ; %1 : Nsat
58 h = sqrt (mu. a . ( 1 e . 2 ) ) ; %1 : Nsat
59 Eo = 2 atan ( tan (TAo/ 2 ) . sqrt ((1 e ) ./(1+ e ) ) ) ; %1 : Nsat
24
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
K. Loh
M = Eo e . sin ( Eo ) ; %1 : Nsat
c o e 0 = [ h e W / deg i n c l / deg wp / deg TAo / deg ] ;
to = 0 ;
t f = t o + T ;%1 2 4 3 6 0 0 ;
t i m e s=t o : dt : t f ;
P = a .(1 e . 2 ) ;
f a c = 3/2 J2 ( Re . / P) . 2 ;
Mdot = ( 2 pi . /T) . ( 1 + f a c . sqrt (1 e . 2 ) . ( 1 ( 3 / 2 ) . sin ( i n c l ) . 2 ) ) ;
Wdot = Mdot . f a c . cos ( i n c l ) ;
wpdot = f a c . Mdot.( 5/2 sin ( i n c l ) . 2 + 2 ) ;
f o r i =1: Nsat
[ R0 V0 ] = s v f r o m c o e ( c o e 0 ( i , : ) ,mu) ;
Rplot ( 1 , : , i ) = [ R0 V0 ] ;
f p r i n t f ( \n Sat # = %d , h = %g km, i = %g deg , Wo = %g deg , wpo = %g
deg , TAo = %g deg , Mo = %g deg \n , i , hP( i ) , i n c l ( i ) / deg , W( i ) /
deg , wp( i ) / deg , TAo( i ) / deg , M( i ) / deg ) ;
end
find ra and dec
figure (2)
ground map
f o r i i = 1 : Nsat
form separate curves
plot ground track
end
% print orbital data
figure (1)
output
figure (3)
plot ( t / hours , SEE ( : , Nsat +1) , k ) ;
axis ( [ t ( 1 ) / h o u r s t ( end ) / h o u r s 0 1 . 1 ] ) ;
xlabel ( Time ( Hours ) ) ; ylabel ( O b s e r v a t i o n ) ;
fprintf ( Final o r b i t a l elements ) ;
f o r i =1: Nsat
f p r i n t f ( \n Sat # = %d , h = %g km, i = %g deg , Wo = %g deg , wpo = %g
deg , TAo = %g deg , Mo = %g deg \n , i , hP( i ) , i n c l ( i ) / deg , W( i ) /
deg , wp( i ) / deg , TA( i ) / deg , M( i ) / deg ) ;
end
[ p c o v e r m e a n r e s p o n s e m a x r e s p on s e ] = t e s t t (SEE ( : , Nsat +1) , t ) ;
f p r i n t f ( \n P e r c e n t a g e c o v e r a g e = %g p e r c e n t | Mean r e s p o n s e time = %g
s e c o n d s | Max r e s p o n s e time = %g s e c o n d s \n , p c o v e r 1 0 0 ,
mean response , m a x r e s p on s e )
% f i g u r e (4)
% p l o t ( t / hours , a l t , k ) ;
return
function i n i t i a l i z e w a l k e r
f p r i n t f ( I n i t i a l s a t e l l i t e c o n s t e l l a t i o n p r o p e r t i e s \n )
f o r i =1: Nsat
pindex ( i ) = c e i l ( i / NSsat ) ;
Spindex ( i ) = i ( pindex ( i ) 1 ) NSsat 1 ;
f s a t i n d e x ( i ) = abs(1 sign ( Spindex ( i ) ) ) ;
TAo( i ) = TAo1 + Spindex ( i ) beta + ( pindex ( i ) 1) f PU;
W( i ) = Wo1( i ) + ( pindex ( i ) 1 ) dRAAN;
end
end
function f i n d r a a n d d e c %Get s u b s a t e l l i t e p o i n t and a l s o d e t e r m i n e i f
s a t e l l i t e can s e e t h e t a r g e t
r a ( 1 : length ( t i m e s ) , 1 : Nsat ) = 0 ;
dec ( 1 : length ( t i m e s ) , 1 : Nsat ) = 0 ;
theta = 0;
r r e l m a g ( 1 : length ( t i m e s ) , 1 : Nsat ) = 0 ;
f o r i = 1 : length ( t i m e s )
t ( i ) = times ( i ) ;
f o r i i = 1 : Nsat
M( i i ) = M( i i ) + Mdot ( i i ) dt ;
E( i i ) = k e p l e r E ( e ( i i ) ,M( i i ) ) ;
TA( i i ) = 2 atan ( tan (E( i i ) / 2 ) sqrt ((1+ e ( i i ) ) /(1 e ( i i ) ) ) ) ;
r = h ( i i ) 2/mu/ ( 1 + e ( i i ) cos (TA( i i ) ) ) [ cos (TA( i i ) ) sin (TA( i i ) ) 0 ] ;
W( i i ) = W( i i ) + Wdot( i i ) dt ;
wp( i i ) = wp( i i ) + wpdot ( i i ) dt ;
c o e 0 = [ h ( i i ) e ( i i ) W( i i ) i n c l ( i i ) wp( i i ) TA( i i ) ] ;
[ R0 V0 ] = s v f r o m c o e ( coe0 ,mu) ; %Obtain R, V f o r p l o t t i n g
Rplot ( i , : , i i ) = [ R0 V0 ] ;
Rone = R3(W( i i ) ) ;
Rtwo = R1( i n c l ( i i ) ) ;
Rthree = R3(wp( i i ) ) ;
QxX = ( Rthree RtwoRone ) ;
R = QxX r ;
t h e t a = we ( t ( i ) t o ) ;
25
26
K. Loh
137
Q = R3( t h e t a ) ;
138
r r e l = QR;
139
r r e l m a g ( i , i i ) = norm( r r e l ) ;
140
[ alpha d e l t a ] = r a a n d d e c f r o m r ( r r e l ) ;
141
142
ra ( i , i i ) = alpha ;
143
dec ( i , i i ) = d e l t a ;
144
end
145 end
146
147 SEE ( 1 : length ( t i m e s ) , 1 : Nsat +1) = 0 ;
148 f o r i = 1 : length ( t i m e s )
149
t i = times ( i ) ;
150
f o r i i = 1 : Nsat
151
a l t = r r e l m a g ( i , i i ) Re ;
152
clambda = 1( h prime 2 a l t 2 ) / ( 2 Re ( Re + a l t ) ) ; %Cos lambda
153
IAA = KA. ( 1 clambda ) ;
154
l a t P p r i m e = pi /2 l a t T ; %T r a n s f o r m a t i o n from l a t l o n g t o
a c c e s s are a c o o r d i n a t e s ( S e c t i o n 9 . 1 M i ss i o n Geometry (
Wertz )
155
l a t S S P p r i m e = pi /2 dec ( i , i i ) ;
156
d e l t a L = r a ( i , i i ) deg longT ;
157
lambda ( i , i i ) = a c o s d ( clambda ) ;
158
lambda0 ( i , i i ) = a c o s d ( Re / ( Re + a l t ) ) ;
159
rlambda ( i , i i ) = a c o s d ( cos ( l a t P p r i m e ) cos ( l a t S S P p r i m e ) + sin (
l a t P p r i m e ) sin ( l a t S S P p r i m e ) cos ( d e l t a L ) ) ; %Angular
D i s t a n c e from t a r g e t t o s u b s a t e l l i t e p o i n t , D i t t o Eqn 99
160
i f ( rlambda ( i , i i ) > 1 8 0 )
161
rlambda ( i , i i ) = 360 rlambda ( i , i i ) ;
162
end
163
i f ( rlambda ( i , i i ) <= min( lambda ( i , i i ) , lambda0 ( i , i i ) ) )
164
SEE( i , i i ) = 1 ; %I f t a r g e t i s w i t h i n t h e minimum o f e i t h e r
lambda or lambda0 , then , i t i s c o v e r e d by t h e i i t h
satellite
165
end
166
end
167
SEE( i , Nsat +1) = sign (sum(SEE( i , 1 : Nsat ) ) ) ; %As l o n g as t h e r e i s one
s a t e l l i t e c o v e r e d , t h e n t h e t a r g e t i s c o v e r e d by t h e
constellation
168 end
169
170 end %f i n d r a a n d d e c
27
%
function f o r m s e p a r a t e c u r v e s
%
% Breaks t h e ground t r a c k up i n t o s e p a r a t e c u r v e s which s t a r t
% and t e r m i n a t e a t r i g h t a s c e n s i o n s i n t h e range [ 0 , 3 6 0 deg ] .
%
tol = 100;
curve no = 1;
n curves = 1;
k = 0;
ra prev = ra (1 , i i ) ;
f o r i = 1 : length ( r a )
i f abs ( r a ( i ) r a p r e v ) > t o l
curve no = curve no + 1;
n curves = n curves + 1;
k = 0;
end
k = k + 1;
RA{ c u r v e n o } ( k ) = r a ( i , i i ) ;
Dec{ c u r v e n o } ( k ) = dec ( i , i i ) ;
ra prev = ra ( i , i i ) ;
end
end %f o r m s e p a r a t e c u r v e s
%
function p l o t g r o u n d t r a c k
%
for i = 1 : n curves
plot (RA{ i } , Dec{ i } , . r , M ar k e r S i z e , 4 )
end
plot ( longT / deg , l a t T / deg , ow ) ;
% a x i s ( [ 0 360 90 9 0 ] )
text ( P o s i t i o n , [ r a ( 1 , i i ) dec ( 1 , i i ) ] , S t r i n g , [ o S t a r t num2str ( i i )
])
text ( P o s i t i o n , [ r a ( end , i i ) dec ( end , i i ) ] , S t r i n g , [ o F i n i s h num2str
( ii ) ])
text ( P o s i t i o n , [ longT / deg , l a t T / deg ] , S t r i n g , Target , F o n t S i z e ,
12 , Color , white )
l i n e ( [ min( r a ( : , i i ) ) max( r a ( : , i i ) ) ] , [ 0 0 ] , C o l o r , k ) %t h e e q u a t o r
end %p l o t g r o u n d t r a c k
28
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
K. Loh
29
l i n e ( [ 0 2Re ] , [ 0 0 ] , [ 0 0 ] ) ; text ( 2 Re , 0 , 0 , X )
l i n e ( [ 0 0 ] , [ 0 2Re ] , [ 0 0 ] ) ; text ( 0 , 2Re , 0 , Y )
l i n e ( [ 0 0 ] , [ 0 0 ] , [ 0 2Re ] ) ; text ( 0 , 0 , 2Re , Z )
% P l o t t h e o r b i t , draw a r a d i a l t o t h e s t a r t i n g p o i n t
% and l a b e l t h e s t a r t i n g p o i n t ( o ) and t h e f i n a l p o i n t ( f )
hold on
f o r i i =1: Nsat
plot3 ( Rplot ( : , 1 , i i ) , Rplot ( : , 2 , i i ) , Rplot ( : , 3 , i i ) , k )
%
l i n e ( [ 0 r0 ( 1 ) ] , [ 0 r0 ( 2 ) ] , [ 0 r0 ( 3 ) ] )
i f ( i i ==1)
d r a w s a t ( Rplot ( 1 , 1 : 3 , i i ) , [ 3 5 0 350 3 5 0 ] , g , 1 ) ;
else
d r a w s a t ( Rplot ( 1 , 1 : 3 , i i ) , [ 3 5 0 350 3 5 0 ] , r , 1 ) ;
end
end
% S e l e c t a v i e w d i r e c t i o n ( a v e c t o r d i r e c t e d outward from t h e o r i g i n )
view ( [ 1 , 1 , . 4 ] )
% S p e c i f y some p r o p e r t i e s o f t h e graph
grid on
axis e q u a l
xlabel ( km )
ylabel ( km )
z l a b e l ( km )
end %o u t p u t
%
function p r i n t o r b i t a l d a t a
%
c o e = [ h e Wo i n c l wpo TAo ] ;
[ ro , vo ] = s v f r o m c o e ( coe , mu) ;
f p r i n t f ( \n \n )
f p r i n t f ( \n Angular momentum = %g km2/ s , h )
f p r i n t f ( \n E c c e n t r i c i t y = %g , e )
f p r i n t f ( \n Semimajor a x i s = %g km , a )
f p r i n t f ( \n P e r i g e e r a d i u s = %g km , rP )
f p r i n t f ( \n Apogee r a d i u s = %g km , rA )
f p r i n t f ( \n P e r i o d = %g h o u r s , T/ 3 6 0 0 )
f p r i n t f ( \n I n c l i n a t i o n = %g deg , i n c l / deg )
f p r i n t f ( \n I n i t i a l t r u e anomaly = %g deg , TAo/ deg )
f p r i n t f ( \n I n i t i a l RA = %g deg , Wo/ deg )
f p r i n t f ( \n RA dot = %g deg / day , Wdot/ deg ( t f t o ) )
f p r i n t f ( \n I n i t i a l wp = %g deg , wpo/ deg )
30
293
294
295
296
297
298
299
300
301
302
303
K. Loh
fprintf (
fprintf (
fprintf (
fprintf (
fprintf (
fprintf (
fprintf (
end %p r i n t o r b i t a l d a t a
end %g r o u n d t r a c k
%
1 function o r b i t %s i m i l a r t o g r o u n d t r a c k .m e x c e p t t h a t s t a t e v e c t o r i s
p r o p a g a t e d i n s t e a d u s i n g Newton s law
2
clc ; close a l l ; clear a l l
3
global r a dec n c u r v e s RA Dec
4
hours = 3600;
5
deg = pi / 1 8 0 ;
6
%. . . Input data :
7
% Earth :
8
R = 6378;
9
mu = 3 9 8 6 0 0 ;
10
we = ( 2 pi + 2 pi / 3 6 5 . 2 6 ) / ( 2 4 3 6 0 0 ) ;
11
%P h y s i c a l model i n p u t
12
J 2 i n c = 1 ; %I n c l u d e J2 p e r t u r b a t i o n e f f e c t s ? 1 yes , 0 f o r no
13
l o w t h r u s t = 0 ; %I n c l u d e low t h r u s t t a n g e n t i a l t o o r b i t p a t h ? 1 yes ,
0 no
14
a t t h r u s t = 5 e 6;
15
Atmos drag = 0 ; %I n c l u d e a t m o s p h e r i c drag ? 1 yes , 0 no
16
b a l l c o e f f = 1 5 0 ; % B a l l i s t i c c o e f f i c i e n t Used f o r a t m o s p h e r i c dr ag
calculations
17
%S i m u l a t i o n Parameters
18
t0 = 0 ;
19
t f = 124 h o u r s ;
20
dt = 2 0 ; %i n s e c o n d s f o r ode4 r o u t i n e
21
%I n i t i a l O r b i t p a r a m e t e r s
22
hP = 4 0 0 ;
23
hA = 4 0 0 ;
24
TAo = 0 deg ;
31
Wo = 0 deg ;
i n c l = 5 1 . 4 3 deg ;
wpo = 0 deg ;
%T a r g e t l a t i t u d e and l o n g i t u d e
l a t T = 2 5 . 6 1 1 deg ; %3 6 . 3 7 2 deg ;
longT = 8 5 . 1 4 4 deg ;%1 2 7 . 3 6 3 deg ;
%S a t e l l i t e p a y l o a d p a r a m e t e r s
Da = 1 ;
WL = 1 . 1 1 e 2;
x res = 1.1;
KA = 2 0 6 2 6 . 4 8 0 6 ; % f o r IAA area i n deg 2
% . . . End i n p u t d a t a
%C a l c u l a t e Earth c e n t r a l a n g l e from p a y l o a d p a r a m e t e r s
h prime = Da x r e s 1 e 3/(2.440WL) ; %From R a y l e i g h o p t i c a l r e s o l u t i o n
(km)
39
40
%Numerical c o n d i t i o n s
41
rkr45 int = 0;
42
% Obtain R0 and V0 v e c t o r s from coe d a t a
43
rP = hP + R; rA = hA + R;
44
a = ( rA + rP ) / 2 ;
45
T = 2 pi / sqrt (mu) a ( 3 / 2 ) ;
46 %
t f = 0 . 5 T;
47
e = ( rA rP ) / ( rA + rP ) ;
48
h = sqrt (mua ( 1 e 2 ) ) ;
49
50
c o e = [ h e Wo i n c l wpo TAo ] ;
51
coe0 = coe ;
52
[ r 0 v0 ] = s v f r o m c o e ( coe ,mu) ;
53
% . . . Numerical i n t e g r a t i o n :
54 %
mu = G(m1 + m2) ;
55
t h e t a = 0 ; %Earth r e v o l u t i o n
56
y0 = [ r 0 v0 t h e t a ] ;
57
i f ( r k r 4 5 i n t == 1 )
58
[ t , y ] = r k f 4 5 ( @rates , [ t 0 t f ] , y0 ) ;
59
else
60
t = t 0 : dt : t f ;
61
[ y ] = ode5 ( @rates , t , y0 ) ;
62
end
63
c o e 1 = c o e f r o m s v ( y ( end , 1 : 3 ) , y ( end , 4 : 6 ) ,mu) ;
64
% . . . Output t h e r e s u l t s :
65
figure (1)
32
K. Loh
66
output
67
find ra and dec
68
figure (2)
69
form separate curves
70
plot ground track
71
print orbital data
72
figure (3)
73
plot ( t / hours , SEE , k ) ;
74
figure (4)
75
plot ( t / hours , a l t , k ) ;
76
77 [ p c o v e r m e a n r e s p o n s e m a x r e s p on s e ] = t e s t t (SEE , t ) ;
78 m e a n a l t = mean( a l t ) ;
79 f p r i n t f ( \n A l t i t u d e = %g km | P e r c e n t a g e c o v e r a g e = %g p e r c e n t | Mean
r e s p o n s e time = %g s e c o n d s | Max r e s p o n s e time = %g s e c o n d s \n ,
mean alt , p c o v e r 1 0 0 , mean response , m a x r e s p on s e )
80 %
a x i s ( [ 0 t f / hours 0 1 . 1 ] ) ;
81 return
82
83 function dydt = r a t e s ( t , f )
84
x = f (1) ;
85
y = f (2) ;
86
z = f (3) ;
87
vx = f ( 4 ) ;
88
vy = f ( 5 ) ;
89
vz = f ( 6 ) ;
90 %
we = 0 ; %(2 p i + 2 p i / 3 6 5 . 2 6 ) / ( 2 4 3 6 0 0 ) ;
91
r = norm ( [ x y z ] ) ;
92
i f ( ( J 2 i n c == 1 ) && ( i n c l = 0 ) )
93
%To c a l c u l a t e J2 o r b i t p e r t u r b a t i o n from Chobotov Q u e s t i o n 1 0 . 5 J2
94
%p e r t u r b a t i o n i n C a r t e s i a n c o o r d i n a t e s
95
J2 = 0 . 0 0 1 0 8 2 6 3 ;
96
f a c = (mu/ r 2 ) ( 3 / 2 ) J2 (R/ r ) 2 ;
97
px = f a c ( x/ r ) (1 5( z / r ) 2 ) ;
98
py = f a c ( y/ r ) (1 5( z / r ) 2 ) ;
99
pz = f a c ( z / r ) (3 5( z / r ) 2 ) ;
100
else
101
P( 1 : 3 ) = 0;
102
px = 0 ;
103
py = 0 ;
104
pz = 0 ;
105
end
33
34
147
148
149
150
151
152
153
154
155
156
K. Loh
r = [ y( ii ,1) y( ii ,2) y( ii ,3) ] ;
a l t ( i i ) = norm( r ) R;
clambda ( i i ) = 1( h prime 2 a l t ( i i ) 2 ) / ( 2 R (R + a l t ( i i ) ) ) ;
IAA = KA. ( 1 clambda ) ;
l a t P p r i m e = pi /2 l a t T ;
l a t S S P p r i m e = pi /2 dec ( i i ) ;
d e l t a L = r a ( i i ) deg longT ;
lambda ( i i ) = a c o s d ( clambda ( i i ) ) ;
lambda0 ( i i ) = a c o s d (R/ (R + hP) ) ;
rlambda ( i i ) = a c o s d ( cos ( l a t P p r i m e ) cos ( l a t S S P p r i m e ) + sin (
l a t P p r i m e ) sin ( l a t S S P p r i m e ) cos ( d e l t a L ) ) ;
i f ( rlambda ( i i ) > 1 8 0 )
rlambda ( i i ) = 360 rlambda ( i i ) ;
end
i f ( rlambda ( i i ) <= min( lambda ( i i ) , lambda0 ( i i ) ) )
SEE( i i ) = 1 ;
end
157
158
159
160
161
162
163 end
164
165 end %f i n d r a a n d d e c
166
167 function output
168
f o r i = 1 : length ( t )
169
r ( i ) = norm ( [ y ( i , 1 ) y ( i , 2 ) y ( i , 3 ) ] ) ;
170
end
171
[ rmax imax ] = max( r ) ;
172
[ rmin imin ] = min( r ) ;
173
v a t r m a x = norm ( [ y ( imax , 4 ) y ( imax , 5 ) y ( imax , 6 ) ] ) ;
174
v a t r m i n = norm ( [ y ( imin , 4 ) y ( imin , 5 ) y ( imin , 6 ) ] ) ;
175
f p r i n t f ( \n\n\
n)
176
f p r i n t f ( \n Earth O r b i t \n )
177
f p r i n t f ( %s \n , d a t e s t r ( now ) )
178
f p r i n t f ( \n The i n i t i a l p o s i t i o n i s [%g , %g , %g ] (km) . , . . .
179
r0 (1) , r0 (2) ,
r0 (3) )
180
f p r i n t f ( \n Magnitude = %g km\n , norm( r 0 ) )
181
f p r i n t f ( \n The i n i t i a l v e l o c i t y i s [%g , %g , %g ] (km/ s ) . , . . .
182
v0 ( 1 ) , v0 ( 2 ) ,
v0 ( 3 ) )
183
f p r i n t f ( \n Magnitude = %g km/ s \n , norm( v0 ) )
184
f p r i n t f ( \n I n i t i a l time = %g h . \ n F i n a l time = %g h . \ n , 0 , t f / h o u r s )
35
36
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
K. Loh
axis e q u a l
box on
set ( gca , XLim , [ 0 3 6 0 ] , YLim ,[ 90 9 0 ] , . . .
XTick , [ 0 60 120 180 240 300 3 6 0 ] , . . .
Y t i c k ,[ 90 60 30 0 30 60 9 0 ] ) ;
hold on
image ( [ 0 3 6 0 ] , [ 9 0 9 0 ] , topo , CDataMapping , s c a l e d ) ;
colormap ( topomap1 ) ;
xlabel ( East l o n g i t u d e ( d e g r e e s ) )
ylabel ( L a t i t u d e ( d e g r e e s ) )
axis e q u a l
grid on
for i = 1 : n curves
plot (RA{ i } , Dec{ i } , r )
end
plot ( longT / deg , l a t T / deg , o r ) ;
% a x i s ( [ 0 360 90 9 0 ] )
text ( r a ( 1 ) , dec ( 1 ) , o S t a r t )
text ( r a ( end ) , dec ( end ) , o F i n i s h )
text ( longT / deg , l a t T / deg , Target )
l i n e ( [ min( r a ) max( r a ) ] , [ 0 0 ] , C o l o r , k ) %t h e e q u a t o r
end %p l o t g r o u n d t r a c k
%
function p r i n t o r b i t a l d a t a
%
c o e = [ h e Wo i n c l wpo TAo ] ;
[ ro , vo ] = s v f r o m c o e ( coe , mu) ;
f p r i n t f ( \n \n )
f p r i n t f ( \n Angular momentum = %g km2/ s , h )
f p r i n t f ( \n E c c e n t r i c i t y = %g , e )
f p r i n t f ( \n Semimajor a x i s = %g km , a )
f p r i n t f ( \n P e r i g e e r a d i u s = %g km , rP )
f p r i n t f ( \n Apogee r a d i u s = %g km , rA )
f p r i n t f ( \n P e r i o d = %g h o u r s , T/ 3 6 0 0 )
f p r i n t f ( \n I n c l i n a t i o n = %g deg , i n c l / deg )
f p r i n t f ( \n I n i t i a l t r u e anomaly = %g deg , TAo/ deg )
% f p r i n t f ( \ n Time s i n c e p e r i g e e = %g hours , t o /3600)
f p r i n t f ( \n I n i t i a l RA = %g deg , Wo/ deg )
% f p r i n t f ( \ n RA dot = %g deg / p e r i o d , Wdot/ deg T)
f p r i n t f ( \n I n i t i a l wp = %g deg , wpo/ deg )
% f p r i n t f ( \ n w p d o t = %g deg / p e r i o d , wpdot / deg T)
37
38
307
308
309
310
311
312
313
314
315
316
fprintf (
fprintf (
fprintf (
fprintf (
fprintf (
fprintf (
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
\n )
\n r 0 = [%12g , %12g , %12g ] (km) , r o ( 1 ) , r o ( 2 ) , r o ( 3 ) )
\n magnitude = %g km\n , norm( r o ) )
\n v0 = [%12g , %12g , %12g ] (km) , vo ( 1 ) , vo ( 2 ) , vo ( 3 ) )
\n magnitude = %g km\n , norm( vo ) )
\n \n )
end %p r i n t o r b i t a l d a t a
end %o r b i t
%
E
1
2
3
4
5
6
7
8
9
10
K. Loh
function [ p c o v e r m e a n r e s p o n s e m a x r e s p on s e m i n r e s p o n s e ] = t e s t t ( x , t )
dt = ( t ( end ) t ( 1 ) ) / ( length ( t ) ) ;
p c o v e r = sum( x ) / length ( x ) ;
t r e s p o n s e ( 1 : length ( t ) ) = 0 ;
f o r i =1: length ( t )
i f ( x ( i ) > 0)
t response ( i ) = 0;
e l s e i f ( i =length ( t ) )
ii = i ;
while ( ( x ( i i ) <= x ( i i +1) )&&(x ( i i ) < 1 ) ) %End o f Gap r e a c h e d when
x ( i i ) == 1
t r e s p o n s e ( i ) = t r e s p o n s e ( i ) + dt ;
i i = i i + 1;
i f ( i i == length ( t ) )
break
end
end
else
t r e s p o n s e ( i ) = t r e s p o n s e ( i ) + dt ; %A l r e a d y a t t h e end , and i t
i s a gap , so , add d t
end
end
n t r e s p o n s e = nonzeros ( t r e s p o n s e ) ;
t o t a l r e s p o n s e = sum( t r e s p o n s e ) ;
m a x r e s p on s e = max( n t r e s p o n s e ) ;
m i n r e s p o n s e = min( n t r e s p o n s e ) ;
m e a n r e s p o n s e = t o t a l r e s p o n s e / length ( t ) ;
39