Project 3: Ballistic Missile Defense Charles Hunter Jason Runkle 17 April 2012 Orbital: AME30381
Executive Summary The purpose of this project is to determine which of nineteen major cities in the United States can be hit by an ICBM launched from a missile silo in Iran and the most probable trajectory for each missile. MATLAB was used to create several programs which plot the maximum missile range on the oblate Earth spheroid. A list of major US cities considered in the project is presented along with the launch parameters: azimuth (Az), elevation (El), ∆v, and time of flight (T OF ) needed to hit the cities in range. A plot of the missile ground track (rotating and non-rotating) is provided as well. The project determined that twelve of the nineteen U.S. cities are within the range of an ICBM from Iran.
1
Introduction
Today we live in a world in which terrorist actions are a constant threat. One such threat is an intercontinental ballistic missile (ICBM). As far as the media can be trusted, Iran has expressed interest in creating ICBMs. In order to prepare for this threat, the United States must determine where a missile from Iran could hit inside of the country. This is a study which faces the possible threat and determines some of the major cities in the United States that are in range of a ballistic missile and what trajectory the missile would likely take to reach any of the cities in range. We will assume the following for further calculations: Earth is a uniform, oblate spheroid with ae = 1 DU and µ = 1 DU3 /TU2 (this simplifies the geometry of the Earth for calculations and plotting by getting rid of any geological features such as mountain ranges, valleys, etc; in reality, the earth has deformations, mountain ranges, oceans, etc. that change the altitude and betray uniformity), no atmosphere, drag, third body, or any other external forces or torques other than gravity (this limits the forces to the gravitational pull of the Earth only; in reality, these would cause disruptions to the missile and decrease its overall range), ∆v is instantaneous (this simplifies calculations by having all the kinetic energy present at launch; in reality, the ∆v would be continuous from rest and would extend the time of flight, T OF , and range of the missile), and all locations are at sea level (i.e. H = 0 at all cities; the actual elevation for each city would slightly alter the T OF and launch parameters, but is not considered in this study for simplicity).
We are given that: ∆vmax is 7.5891 km/s (0.2548 DU/TU), location of the ballistic missile silo [36.74◦ N, 48.8◦ E], and minimum deviation angle, Elmin , is 30◦ off horizontal when launched. What we need to determine is: the maximum terrestrial range of the Iranian ICBM, a plot of the maximum range for all degrees of launch Azimuth (i.e. ∀Az), a plot of the line of maximum range on the oblate Earth spheroid (including cities and silo position), a list of the major US cities in range of the Iranian silo, a single set of launch parameters for each city in range including – launch Azimuth, Az, – Elevation off horizontal, El, – instantaneous launch velocity change, ∆v, and – time of flight, T OF , in minutes, and a plot of the trajectories and ground track (rotating and non-rotating) for each. Outside information necessary for problem solution: angular velocity of the Earth, ωe = 0.05884 rad/TU1 , eccentricity of the oblate Earth spheroid, e = 0.081822 , and MATLAB plotearth function3 .
2
Approach
2.1
Task 1: Determine Maximum Terrestrial Range
The first task is to determine the maximum terrestrial range of the Iranian ICBM. 2.1.1
Initial Position and Velocity
First, to get the initial position, use the latitude and longitude (assuming zero altitude). To get into the IJK system, use the following equations for x and z: ! ! 1 ae p p cos L = cos L, and (1) x = 2 1 − e2 sin L 1 − e2 sin2 L ! ! ae (1 − e2 ) 1 − e2 p p z = sin L = sin L, (2) 1 − e2 sin2 L 1 − e2 sin2 L 1
Bate, R.R., Mueller, D.D., and White, J.E., Fundamentals of Astrodynamics, (New York: Dover Publications), 1971. 2 Fundamentals of Astrodynamics 3 Luong, Bruno, plotearth function, MATLAB File Exchange, http://www.mathworks.com/ matlabcentral/fileexchange/25048
2
where ae is the semi-major axis of the earth (ae = 1 DU), e is the eccentricity of the earth, and L is the latitude. Additionally, the relative sidereal time, θ, is required. This can be obtained by θ = θg0 + ωe (t − t0 ) + λe ,
(3)
where θg0 is the GST at epoch, ωe is the angular velocity of the earth (magnitude), t is the time, t0 is the start time, and λe is the East longitude. Then, apply the following equation to get the position in the IJK system: ˆ R0IJK = x cos θIˆ + x sin θJˆ + z K.
(4)
Additionally, calculate the velocity of the earth at that position: VRIJK = ω ~ e × R0IJK . 0
(5)
Since it will be used later, also calculate the matrix D that transforms vectors from SEZ to IJK: sin L cos θ − sin θ cos L cos θ D = sin L sin θ cos θ cos L sin θ . (6) − cos L 0 sin L Then, calculate the relative velocity in the SEZ system, ρ~˙ SEZ , from ∆vmax = ρ, ˙ ˙ + ρ cos El sin Az Az ˙ −ρ˙ cos El cos Az + ρ sin El cos Az El ˙ + ρ cos El cos Az Az ˙ ρ~˙ SEZ = ρ˙ cos El sin Az − ρ sin El sin Az El ˙ ρ˙ sin El + ρ cos ElEl
(7)
by picking a value of El and Az (eventually all Az will be tested in Task 2). Running a simple test of alternative El, it was determined that Elmin led to the longest ranges for all cases. Now, since ρ~˙ is the relative velocity in the SEZ system, the relative velocity in IJK is simply ρ~˙ IJK = Dρ~˙ SEZ .
(8)
Finally, transform to the absolute velocity by adding in the velocity of the position V0IJK = ρ~˙ IJK + VRIJK . 0 2.1.2
(9)
Trajectory
Next, to calculate the trajectory, we need to determine a time of flight (T OF ). For this, take advantage of the fact that the trajectory will follow a section of an ellipse. Therefore, 3
calculate the period of an ellipse to make sure the trajectory intersects the earth. This is accomplished by calculating the energy of the ellipse from the position and velocity, then calculating the semi-major axis of the ellipse, and finally get the period: r = ||R0 ||2 , v = ||V0 ||2 , v2 1 v2 µ − = − , E = 2 r 2 r 1 a = − , and 2E T = 2πa3/2 = T OF,
(10) (11) (12) (13) (14)
where E is the specific mechanical energy of the ellipse, a is the semi-major axis of the ellipse, 3 µ is the gravitational constant µ = GM = 1 DU2 , and T is the period of the ellipse. TU Next plug in the equation for Newton’s law of universal gravitation: Fg = m~a = − ~a = −
µ mˆ r, r2
1 R0 , r3
(15) (16)
where Fg is the force of gravity, m is the mass of the ICBM, and ~a is the vector acceleration of the ICBM. Plug this into MATLAB using ode45 with two first order ODEs: d R V = . (17) ~a dt V 2.1.3
Latitude, Longitude, H
IJK Next, convert the radius of the trajectory (Rtraj ) into latitude, longitude and altitude. To accomplish this, reverse the steps taken earlier. Recognize that,
∴
ˆ = x cos θIˆ + x sin θJˆ + z K, ˆ Rtraj = X Iˆ + Y Jˆ + Z K X x cos θ Y = x sin θ , Z z
where it is clear that z = Z. Also x can be calculated because p x = x2 cos2 θ + x2 sin2 θ, √ x = X 2 + Y 2.
(18) (19)
(20) (21)
Notice that longitude is just the angle between R and the plane of the prime meridian.
4
This angle can be obtained since it has a tangent defined by: tan λe =
Y . X
(22)
Now, inverting Equations (1) and (2) and solving both for H: x 1 −p , cos L 1 − e2 sin2 L e2 − 1 z +p . H(z, L) = sin L 1 − e2 sin2 L
H(x, L) =
and
(23) (24)
Using these definitions, eliminate H in each original equation to come up with two equations x(L) and z(L): ! z e2 +p x(L) = cos L, and (25) sin L 1 − e2 sin2 L ! 2 e x −p sin L, (26) z(L) = cos L 1 − e2 sin2 L either of which can be solved for L (latitude) given a guess for L0 and using MATLAB’s built in fzero function. The reason to include both is to account for numerical issues when L is near 0◦ or 90◦ . Finally, determine H by applying Equation (23) when L is near 0◦ and Equation (24) when L is near 90◦ . 2.1.4
Determine Rhit
At this stage, the position at which the trajectory intersects the surface of the earth must be determined. This can be determined by finding when H goes negative and using linear interpolation to set the time and position when H = 0. Thence, if H goes negative at index j: T (j) − T (j − 1) (0 − H(j)) + T (j), and (27) Thit = H(j) − H(j − 1) R(j) − R(j − 1) Rhit = (0 − H(j)) + R(j). (28) H(j) − H(j − 1) 2.1.5
Determine range
To determine the range, transform the Rhit into a latitude and longitude using the method already derived. Using the MATLAB function distance, determine the range at Rhit . Apply this method through all Az and select the maximum range.
5
2.2
Task 2: Plot Maximum Range For All Azimuth
The second task is to plot the maximum range of the ICBM for all degrees of launch azimuth. To accomplish this task, use the range data obtained in Subsection 2.1.5. Using a polar plot with range as the radius and azimuth as the angle, plot the line of maximum range.
2.3
Task 3: Plot Maximum Range on the Oblate Earth Spheroid
The third task is to plot the line of maximum range on the oblate Earth spheroid with all US cities and the Iranian silo. To accomplish this task, use the Rhit data obtained in Subsection 2.1.4. Plot the oblate Earth spheroid and the line of Rhit points to get a line of maximum range.
2.4
Task 4: Determine the Major US Cities in Range
The fourth task is to determine which major US cities are in range of the Iranian ICBM. Obviously, this can be noted from the plot of maximum range on the oblate Earth spheroid, but this will also be mathematically checked. To do so, we first need to get ρ, ˙ El, and Az ˙ ˙ from Equation (7). Taking ρ = El = Az = 0, Equation (7) simplifies to: −ρ˙ cos El cos Az ρ˙ S ρ˙ cos El sin Az (29) = ρ˙ E . ρ~˙ SEZ = ρ˙ Z ρ˙ sin El Taking the norm of ρ~˙ , q ˙ ρ˙ 2 cos2 El cos2 Az + ρ˙ 2 cos2 El sin2 Az + ρ˙ 2 sin2 El, ||ρ~ ||2 = q = ρ˙ cos2 El(cos2 Az + sin2 Az) + sin2 El, p = ρ˙ cos2 El + sin2 El = ρ. ˙
(30)
Since El must be between 0◦ and 90◦ , it can be found from cos El and/or sin El obtained by,
∴
∴
ρ˙ 2S + ρ˙ 2E = ρ˙ 2 cos2 El, s ρ˙ 2S + ρ˙ 2E cos El = + , ρ˙ 2 ρ˙ Z = ρ˙ sin El, ρ˙ Z sin El = . ρ˙
6
and
(31) (32) (33) (34)
Using the cos El and sin El, find cos Az and sin Az to get Az: ρ˙ S , ρ˙ cos El ρ˙ E , sin Az = ρ˙ cos El sin Az tan Az = , cos Az cos Az =
(35) and
(36) (37)
which can be solved for Az using MATLAB’s atan2 function. To see if a particular city is within range, see the algorithm in Task 5.
2.5
Task 5: Determine Launch Parameters for Cities in Range
The fifth task is to determine a single set of the following launch parameters for each city in range: Azimuth, Az, Elevation, El, ∆v = ρ, ˙ and T OF in minutes. Apply the following algorithm for each city to see if it is within range and get parameters: 1. Choose an initial T OF , 2. Begin loop while T OF < T OFmax (used 8 TU in this study): (a) Calculate position of the city, Rcity , at T OF , (b) Solve Gauss’s problem to get the absolute velocity of the rocket at launch, V0IJK , IJK ), (c) Find relative velocity (ρ~˙ = V0IJK − Vsilo −1 (d) Convert to SEZ system with D , (e) Calculate ρ˙ from Equation (30), (f) Calculate cos El and sin El to get El from Equations (32) and (34), (g) If El > Elmin AND ρ˙ < ∆vmax , continue, otherwise (h) Increment T OF and repeat from (a) 3. If T OF ≥ T OFmax , city cannot be hit, otherwise 4. Calculate cos Az and sin Az to get Az from Equations (35) and (36).
2.6
Task 6: Plot Trajectories and Ground Tracks
The sixth task is to plot the following for each of the cities in range given the parameters from Task 5: the trajectory, the trajectory projection onto the oblate spheroid, and the trajectory projection onto the rotating surface of the Earth. The trajectory is obtained using the same trajectory method used in Task 1. Once this trajectory has been calculated, use the latitude and longitude to project onto the surface 7
of the earth by setting altitude to zero. This gets the trajectory projection onto the oblate spheroid. To get the projection onto the rotating surface of the Earth, use the latitude and longitude, setting altitude to zero, but rotate the earth at each position to get the proper position at the hit time. This means setting the term t in Equation (3) to be (thit − ti ) where ti is the time at the ith point.
3
Results
Using the solution method derived in Section 2, Figures 1 through 4 are obtained.
3.1
Maximum Range for all Azimuth
Figure 1: Line of maximum range [DU] for all azimuth [0◦ –360◦ ]
8
3.2
Launch Parameters for Major US Cities in Range Table 1: City launch parameters City
Lat [◦ ]
Lon [◦ ]
Az [◦ ]
El [◦ ]
∆v [DU/TU]
T OF [TU]
Washington DC
38.90 N
-77.03 E
313.12
30.01
7.4
36.38
New York City
40.77 N
-77.97 E
313.03
30
7.32
35.02
Boston
42.37 N
-71.06 E
312.92
30.01
7.26
33.84
Pittsburgh
40.44 N
-80.01 E
315.71
30
7.4
36.58
Detroit
42.35 N
-83.06 E
318.58
30
7.39
36.62
Cincinnati
39.11 N
-84.52 E
316.85
30.01
7.46
38.02
Notre Dame
41.70214 N
-86.225624 E
319.75
30.01
7.43
37.56
Chicago
41.88 N
-87.64 E
320.61
30.01
7.44
37.8
Miami
25.79 N
-80.22 E
Atlanta
33.83 N
-84.42 E
New Orleans
29.97 N
-90.11 E
Out of Range
Houston
29.80 N
-95.36 E
Out of Range
Albuquerque
35.14 N
-106.68 E
Out of Range
Phoenix
33.58 N
-112.13 E
Out of Range
Seattle
47.59 N
-122.30 E
343.95
30
7.45
40.48
Portland
45.52 N
-122.70 E
343.51
30
7.5
41.56
San Francisco
37.75 N
-122.45 E
Out of Range
Los Angeles
34.06 N
-118.23 E
Out of Range
Cooperstown
47.43 N
-98.14 E
Out of Range 313.39
329.67
9
30
30
7.57
7.39
40.05
37.6
3.3
Maximum Range on Oblate Earth Spheroid
(a) Iranian Side
(b) United Statesâ&#x20AC;&#x2122; Side
Figure 2: Maximum range on the oblate Earth spheroid (yellow line), numbers are the same as in Table 1
3.4
Trajectories
Figure 3: Trajectory and ground tracks (red = non-rotating, black = rotating), Iran side 10
Figure 4: Trajectory and ground tracks (red = non-rotating, black = rotating), US side
4
Discussion
As the results show, a ballistic missile would be able to hit several major cities in the United States. The range of the missiles was affected by the rotation of the Earth. The Earth rotates at about 47.4672 rad/s resulting in roughly 1343 km/s of tangential velocity at Iranâ&#x20AC;&#x2122;s ICBM 11
silo. The rotational speed of the Earth translates into the velocity of the ballistic missile and negatively affects the range in the Westward direction and positively affects the range in the Eastward direction. Due to the position of the United States from Iran, their missiles would be fired in a slightly Westward direction. Therefore, the United States would have better capabilities to launch a missile to hit Iran because of the velocity assist gained from the Earth’s Eastward rotation. From an economic standpoint, a ballistic missile for the United States would also cost less due to the shorter T OF to fly Eastward and thus less fuel used to reach Iran. There are a few assumptions which are taken into account in the calculations that would significantly affect the results. For one, the ballistic missile model did not account for a drag force. The drag force is proportional to the square of the velocity and with missiles fired at such large velocities this force would severely impact the missile’s range. A missile from Iran may hit the United States with a much more powerful rocket, but would not be possible with the ∆v used in this analysis as the rocket would not have enough fuel. On the other hand, the model also assumed the velocity of the missile was instantaneous from launch. A ballistic missile would not be able to reach a velocity instantly. A missile without the instantaneous velocity assumption would reach the target destination at a longer T OF and therefore a longer distance. Such considerations were ultimately beyond the scope of this study. The United States would have about a half an hour to respond to an Iranian missile from launch. This should be enough time to send out an interceptor missile to shoot down the Iranian missile. The Iranian missile must also have a trajectory that causes it to fly over Europe and their missile defenses and thus risk being shot down long before reaching the United States. With the assumptions accounted for, the threat of an Iranian missile looks much less looming and dangerous to the United States than the media might portray it.
A 1 2 3 4 5 6 7 8
MATLAB code % % % % % % % %
Project 4: Ballistic Missile Defense BallisticMissile.m − determines the maximum terrestrial range of an Iranian ICBM, plots the range for all azimuth, plots the line of maximum range on the oblate Earth spheroid, lists the major US cities in range, gives (azimuth, elevation, ∆V, and TOF) for each city in range, and plots the trajectory, ground track (projection), ground track (actual), and the location of the cities. author: Jason Runkle
9 10
clear; close; clc
11 12 13 14 15 16
% We are given the following: lon = 48.8; %Longitude of Silo, degrees East lat = 36.74; %Latitude of Silo, degrees North rhodMax = 7.5891; %dv max = d/dt(rho) ("rho dot"), km/s ElMin = 30; %minimum deviation angle at launch, degees from horizontal
17
12
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58
% Cities: Names and [Lat Lon] city.name = ... {'Washington DC';... 'New York City';... 'Boston';... 'Pittsburgh';... 'Detroit';... 'Cincinnati';... 'Notre Dame';... 'Chicago';... 'Miami';... 'Atlanta';... 'New Orleans';... 'Houston';... 'Albuquerque';... 'Phoenix';... 'Seattle';... 'Portland';... 'San Francisco';... 'Los Angeles';... 'Cooperston, ND'}; city.latlon = ... [38.9, −77.03;... 40.77, −73.97;... 42.37, −71.06;... 40.44, −80.01;... 42.35, −83.06;... 39.11, −84.06;... 41.70214, −86.225624;... 41.88, −87.64;... 25.79, −80.22;... 33.83, −84.42;... 29.97, −90.11;... 29.80, −95.36;... 35.14, −106.68;... 33.58, −112.13;... 47.59, −122.30;... 45.52, −122.70;... 37.75, −122.45;... 34.06, −118.23;... 47.43, −98.14];
59 60 61 62
% We know the following: omega = [0; 0; 0.0588336565]; %rotation of the earth, rad/TU e = 0.08182;
63 64 65
% We assume the following: thg = 0; %Greenwhich Sidereal Time, hr
66 67 68
%Convert to Canonical Units rhodMax = rhodMax/7.90538; %km/s −> DU/TU
69 70 71
%Find Position of the Silo in IJK [RSilo,VSilo,D] = LLtoR(lat,lon,thg) %DU
13
72 73 74 75 76 77 78 79 80 81 82
%Plot the Earth plotearth; %plot the ellipsoid of the Earth alpha(0.95) %give slight transparency for visibilty of IJK system hold on plot3([0 1.5],[0 0],[0 0],'cyan','LineWidth',2) text([0 1.6],[0 0],[0 0],'I','Color','red','FontSize',16) plot3([0 0],[0 1.5],[0 0],'cyan','LineWidth',2) text([0 0],[0 1.6],[0 0],'J','Color','red','FontSize',16) plot3([0 0],[0 0],[0 1.5],'cyan','LineWidth',2) text([0 0],[0 0],[0 1.6],'K','Color','red','FontSize',16)
83 84 85 86
%Show Iran text(1.1*RSilo(1),1.1*RSilo(2),1.1*RSilo(3),'Iran','Color','red',... 'FontSize',16,'BackgroundColor',[1 1 1])
87 88 89 90 91 92 93 94 95
%Show US Cities for i = 1:length(city.name) CityR = LLtoR(city.latlon(i,1),city.latlon(i,2),0); plot3(CityR(1),CityR(2),CityR(3),'*red','MarkerSize',5) text(1.1*CityR(1),1.1*CityR(2),1.1*CityR(3),num2str(i),... 'Color','white','Rotation',30,'HorizontalAlignment','Center',... 'FontSize',12); end
96 97 98 99 100 101 102
N = 200; %Number of steps %Initialize for looping through Azimuth LatHit = zeros(N); LonHit = LatHit; % range = zeros(N,1); indices = range; Rho = [0;rhodMax]; %rho and rho dot el = [ElMin;0]; %Elevation and elevation dot
103 104 105 106 107
%Initialize Rhit = zeros(N,3); range = zeros(N,1); Az = zeros(N,1);
108 109 110 111 112
%Convert rhodMax to V0 for j = 1:N Az(j) = 360*(j−1)/(N−1); %azimuth, deg az = [Az(j);0]; %Azimuth and azimuth dot
113 114 115 116
% Calculate the trajectory [¬, ¬, ¬, Thit, ¬, ¬, ¬, ¬, ¬, ¬] = ... Trajectory(lat,lon,Rho,az,el,thg,0);
117 118 119
[T, R, V, thit, RHIT, LatHit, LonHit, ¬, ¬, ¬] = ... Trajectory(lat,lon,Rho,az,el,thg,−Thit);
120 121
Rhit(j,1:3) = [RHIT.x; RHIT.y; RHIT.z];
122 123 124 125
[range(j), ¬] = distance(lat,lon,LatHit,LonHit,[1 e]); end % Get the maximum range and print
14
126 127
maxrange = max(range); fprintf('\n The maximum range is: %8.5f DU\n',maxrange)
128 129 130
% plot the line of maximum range on the oblate earth plot3(Rhit(:,1),Rhit(:,2),Rhit(:,3),'yellow','LineWidth',1.5)
131 132 133 134 135
%new figure: polar plot of the azimuth over the range figure polar(Az*pi/180,range,'r'); hold on axis equal
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
%annotate North, East, South, West... annotation('textbox',... [0.85 0.5 0.08 0.05],'String',{'North'},... 'HorizontalAlignment','center','FontWeight','bold',... 'FitBoxToText','off','BackgroundColor',[1 1 1]); annotation('textbox',... [0.475 0.945 0.08 0.05],'String',{'East'},... 'HorizontalAlignment','center','FontWeight','bold',... 'FitBoxToText','off','BackgroundColor',[1 1 1]); annotation('textbox',... [0.1 0.5 0.08 0.05],'String',{'South'},... 'HorizontalAlignment','center','FontWeight','bold',... 'FitBoxToText','off','BackgroundColor',[1 1 1]); annotation('textbox',... [0.475 0.05 0.08 0.05],'String',{'West'},... 'HorizontalAlignment','center','FontWeight','bold',... 'FitBoxToText','off','BackgroundColor',[1 1 1]);
154 155 156 157 158 159 160 161 162 163 164 165 166 167
%Find the velocity vector between Iran and a given city for j = 1:length(city.name) % Guess a tof tof = 20*60/806.80415; %20 min −> TU % Calculate city position at tof Rcity = LLtoR(city.latlon(j,1),city.latlon(j,2),thg,−tof); % Solve Guass' problem [V1, V2] = gauss(RSilo,Rcity,'short',tof); % Get relative position in IJK, convert to SEZ Rhod1 = V1 − VSilo; %in IJK Rhod1 = Dˆ(−1)*Rhod1; %in SEZ % get ∆V = rhod1 rhod1 = norm(Rhod1); %∆V, DU/TU
168 169 170
cosEl = sqrt((Rhod1(1)ˆ2+Rhod1(2)ˆ2)/rhod1ˆ2); %cos(El) sinEl = Rhod1(3)/rhod1; %sin(El)
171 172
El = atan2(sinEl,cosEl)*180/pi; %degs
173 174 175 176 177 178 179
% Check the conditions El vs. ElMin, and rhod1 vs. rhodMax also setting % a maximum tof at 8 TU while(((El < ElMin ) | | ( rhod1 > rhodMax))&&(tof < 8)) %increment tof tof = tof+0.001; %repeat algorithm
15
Rcity = LLtoR(city.latlon(j,1),city.latlon(j,2),thg,−tof); [V1, V2] = gauss(RSilo,Rcity,'short',tof); Rhod1 = V1 − VSilo; %in IJK Rhod1 = Dˆ(−1)*Rhod1; %in SEZ rhod1 = norm(Rhod1); %rhodot = dv cosEl = sqrt((Rhod1(1)ˆ2+Rhod1(2)ˆ2)/rhod1ˆ2); %cos(El) sinEl = Rhod1(3)/rhod1; %sin(El) El = atan2(sinEl,cosEl)*180/pi; %degs
180 181 182 183 184 185 186 187 188
end
189 190 191 192 193 194 195 196
%calculate azimuth cosAz = −Rhod1(1)/(rhod1*cosEl); %cos(Az) sinAz = Rhod1(2)/(rhod1*cosEl); %sin(Az) Az = atan2(sinAz,cosAz)*180/pi; %degs if(Az<0) %if negative, set between 0 and 360 Az = Az+360; end
197 198 199 200
if tof≤8 %if hit fprintf('\n %s was hit with the following parameters,',... city.name{j})
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
%Plot the trajectory az = [Az;0]; %Azimuth and azimuth dot el = [El;0]; %Elevation and elevation dot Rho = [0;rhod1]; %rho and rho dot % get trajectory and ground tracks [T, R, V, thit, RHIT, LatHit, LonHit, groundNR, groundR, ind] = ... Trajectory(lat,lon,Rho,az,el,thg,−tof); figure(1) %plot the trajectory in green plot3(R.x(1:ind),R.y(1:ind),R.z(1:ind),'green') %plot the non−rotating ground track in red plot3(groundNR.x(1:ind),groundNR.y(1:ind),groundNR.z(1:ind),... 'red','LineWidth',1) %plot the rotating ground track in black plot3(groundR.x(1:ind),groundR.y(1:ind),groundR.z(1:ind),... 'black')
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
%convert tof and rhod1=∆V for printout in min and km/s tof = tof*806.80415/60; %min rhod1 = rhod1*7.90538; %km/s fprintf('\n Azimuth: %f degrees',Az) fprintf('\n Elevation: %f degrees',El) fprintf('\n DeltaV: %f km/s',rhod1) fprintf('\n TOF: %f min\n',tof) else %if not hit, tell me where it failed if El<ElMin fprintf('\n %s was out of range due to the Elevation\n',... city.name{j}) end if rhod1>rhodMax fprintf('\n %s was out of range due to the DeltaV\n',... city.name{j})
16
end
234
end
235 236
1 2 3
end
% LLtoR.m − transforms the Latitude and Longitude into a position vector in % IJK coordinates % author: Jason Runkle
4 5 6 7 8 9 10 11 12 13 14
function [R, V, D] = LLtoR(Lat,Lon,thg,t0,t,H,e,omega) %Inputs: % Lat − Latitude, degrees % Lon − Longitude, degrees % thg − Greenwhich sidereal time, rad % t0 − initial time, TU % t − final time, TU % H − altitude, DU % e − eccentricity of the celestial body % omega − angular velocity, rad/TU
15 16 17 18 19
%Outputs: % R − Position vector in IJK % V − Velocity vector at R in IJK % D − rotation matrix from IJK to SEZ
20 21 22
Lat = Lat*pi/180; Lon = Lon*pi/180; %Convert to radians
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
%if H, e, omega, t, t0 unspecified if nargin < 5 | | isempty(t) t = 0; %if no t, set to zero, TU end if nargin < 4 | | isempty(t0) t0 = 0; %if no t0, set to zero, TU end if nargin < 6 | | isempty(H) H = 0; %if altitude is assumed if not specified, DU end if nargin < 7 | | isempty(e) e = 0.08182; %eccentricity of the earth, unitless end if nargin < 8 | | isempty(omega) omega = [0; 0; 0.0588336565]; %rotation of the earth, rad/TU end
40 41 42
%Initialize R R = zeros(3,1);
43 44
th = thg + omega(3)*(t−t0) + Lon; %th = thg + rotation + Longitude, rad
45 46 47 48
%function: x(L) x = (1/sqrt(1−eˆ2*sin(Lat)ˆ2)+H)*cos(Lat); %function: z(L)
17
49
z = ((1−eˆ2)/sqrt(1−eˆ2*sin(Lat)ˆ2)+H)*sin(Lat);
50 51 52 53 54
%If R = R(1)*I + R(2)*J + R(3)*K R(1) = x*cos(th); %function: Rx = x*cos(th) R(2) = x*sin(th); %function: Ry = x*sin(th) R(3) = z;
55 56
V = cross(omega,R);
57 58 59 60 61
1 2 3
cL = cos(Lat); cT = cos(th); sL = sin(Lat); sT = sin(th); D = [sL*cT −sT cL*cT;... sL*sT cT cL*sT;... −cL 0 sL];
% Trajectory.m − uses the (lat,lon) position of a launch site to calculate % the trajectory of a projectile given several launch parameters % author: Jason Runkle
4 5 6 7 8 9 10 11 12 13 14
function [T, R, V, thit, Rhit, LatHit, LonHit, groundNR, groundR, in] = ... Trajectory(lat,lon,Rho,az,el,thg,Thit) % Inputs: % lat − latitude of the launch site, deg % lon − longitude of the launch site, deg % Rho − array with relative position rho and ∆v = rhod, DU, DU/TU % az − array with azimuth and azimuth dot, deg, deg/TU % el − array with elevation and elevation dot, deg, deg/TU % thg − Greenwhich Sidereal Time % Thit − hit time, TU
15 16 17 18 19 20 21 22 23 24 25
%Outputs: % T − array of times, TU % R − structure containing position arrays, DU % V − structure containing velocity arrays, DU/TU % thit − the time of intersection with the surface of the earth, TU % Rhit − the position vector where the trajectory hits earth, DU % LatHit − the latitude where the trajectory hits earth, deg % LonHit − the longitude where the trajectory hits earth, deg % groundNR − structure containing the non−rotating ground track % groundR − structure containing the rotating ground track
26 27 28 29
rho = Rho(1); rhod = Rho(2); Az = az(1); Azd = az(2)*pi/180; El = el(1); Eld = el(2)*pi/180;
30 31
[R0,VofEarth,D] = LLtoR(lat,lon,thg,−Thit);
32 33 34 35 36 37 38
cE = cosd(El); cA = cosd(Az); sE = sind(El); sA = sind(Az); %Calculate the relative position vector in SEZ RhodMax = [−rhod*cE*cA+rho*(sE*cA*Eld+cE*sA*Azd);... rhod*cE*sA+rho*(−sE*sA*Eld+cE*cA*Azd);... rhod*sE+rho*cE*Eld]; RhodIJK = D*RhodMax;
18
39
V0 = RhodIJK+VofEarth;
40 41 42 43 44
% Estimate the TOF: energy = norm(V0)ˆ2/2−1/norm(R0); %specific energy, DUˆ2/TUˆ2 a = −1/(2*energy); %semi−major axis, DU TOF = 2*pi*aˆ(3/2); %time of flight, TU
45 46 47
% Use ode45 to get trajectory [T,RVtraj] = ode45(@Newton,[0 TOF],[R0;V0]);
48 49 50 51
R.x = RVtraj(:,1); R.y = RVtraj(:,2); R.z = RVtraj(:,3);
52 53 54 55
V.x = RVtraj(:,4); V.y = RVtraj(:,5); V.z = RVtraj(:,6);
56 57 58 59
% Initialize Lat, Lon and H vectors LatT = zeros(length(T),1); LonT = LatT; HatT = LatT;
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
% Find hit time (when H goes negative) [LatT(1) LonT(1) HatT(1)] = RtoLLH(RVtraj(1,1:3)); in = 2; for i = 2:length(T) [LatT(i) LonT(i) HatT(i)] = RtoLLH(RVtraj(i,1:3)); %find when H goes negative, store index if HatT(i)≤0 && HatT(i−1)>0 in = i; end end for i = 1:length(T) [gtNR,¬,¬] = LLtoR(LatT(i),LonT(i),thg); %just project H = 0 groundNR.x(i) = gtNR(1); groundNR.y(i) = gtNR(2); groundNR.z(i) = gtNR(3); [gtR,¬,¬] = LLtoR(LatT(i),LonT(i),thg,Thit,−T(i)); groundR.x(i) = gtR(1); groundR.y(i) = gtR(2); groundR.z(i) = gtR(3); end
81 82 83 84 85 86 87 88 89 90 91 92
%Interpolate to find thit at H = 0 thit = (T(in)−T(in−1))/... (HatT(in)−HatT(in−1))*(−HatT(in))+T(in); %and Rhit Rhit.x = interp1(T,R.x,thit); Rhit.y = interp1(T,R.y,thit); Rhit.z = interp1(T,R.z,thit); %set R at cross index to be the Rhit, aligns vectors for plotting R.x(in) = Rhit.x; R.y(in) = Rhit.y;
19
93
R.z(in) = Rhit.z;
94 95 96 97 98 99 100 101 102 103 104 105
1 2
% Project onto the ground track using latitude and longitude [LatHit LonHit ¬] = RtoLLH([Rhit.x; Rhit.y; Rhit.z]); [gtNR,¬,¬] = LLtoR(LatHit,LonHit,thg); %Set the indexed values to be the exact hit locations (for plotting) groundNR.x(in) = gtNR(1); groundNR.y(in) = gtNR(2); groundNR.z(in) = gtNR(3); groundR.x(in) = gtNR(1); groundR.y(in) = gtNR(2); groundR.z(in) = gtNR(3); end
% Newton.m is the differential equation describing the satellite problem % author: Jason Runkle
3 4
function dRVt = Newton(t,RV)
5 6 7
R = RV(1:3); r = norm(R); V = RV(4:6); v = norm(V);
8 9 10
dRt = V; %dR/dt = V + (omega x R) dVt = −R/rˆ3; %dV/dt = (−G*m1*m2*Rhat/rˆ2)/m1 = −mu*Rhat/rˆ2, mu=1
11 12 13
1 2 3
dRVt = [dRt; dVt]; end %eof
% RtoLLH.m − transforms a position vector in IJK to a latitude, longitude % and altitude % author: Jason Runkle
4 5 6 7
function [Lat Lon H] = RtoLLH(R) % Input: % R − position vector in IJK, DU
8 9 10 11 12
% Outputs: % Lat − east latitude, deg % Lon − longitude, deg % H − altitude, DU
13 14
e = 0.08182; %eccentricity of the Earth
15 16
X = R(1); Y = R(2); %For ease of notation
17 18 19
%Caluclate Longitude Lon = atan2(Y,X); %tan(Lon) = Y/X
20 21 22 23
%Calculate x and z x = sqrt(Xˆ2+Yˆ2); %R = x*cos(th)<I>+x*sin(th)<J>+z<K> = X<I>+Y<J>+z<k> z = R(3);
20
24 25 26 27 28
%Solve Numerically for L and H % Guess reduced latitude, beta, and geodetic latitude, L beta = atan2(z,sqrt(1−eˆ2)*x); L0 = atan2(z+eˆ2/sqrt(1−eˆ2)*sin(beta)ˆ3,x−eˆ2*cos(beta)ˆ3);
29 30 31 32
% Begin iteration xeq = @(L) x−(z/sin(L)+eˆ2/sqrt(1−eˆ2*sin(L)ˆ2))*cos(L); zeq = @(L) z−(x/cos(L)−eˆ2/sqrt(1−eˆ2*sin(L)ˆ2))*sin(L);
33 34 35 36 37 38 39
L = fzero(zeq,L0); H = x/cos(L)−1/sqrt(1−eˆ2*sin(L)ˆ2); if (isnan(L ) | | abs(L)>pi/2) L = fzero(xeq,L0); H = z/sin(L)+(eˆ2−1)*1/sqrt(1−eˆ2*sin(L)ˆ2); end
40 41 42
1 2
Lat = L*180/pi; Lon = Lon*180/pi; end
% gauss.m − solves Gauss' problem % author: Jason Runkle
3 4 5 6 7 8 9
function [V1,V2] = gauss(R1,R2,dir,TOF) % Inputs: % R1 − the first position vector, DU % R2 − the second position vector, DU % dir − direction, ['long' or 'short'] % TOF − time of flight, TU
10 11 12 13
% Outputs: % V1 − the velocity vector at position R1, DU/TU % V2 − the velocity vector at position R2, DU/TU
14 15 16
%Set constants: mu = 1; %DU
17 18 19
%Get length of the distance vectors: r1 = norm(R1); r2 = norm(R2); %DU
20 21 22 23 24 25 26
%Find Delta nu: dnu = acos(dot(R1,R2)/(r1*r2)); %rad %Apply direction if(strcmp(dir,'long')) dnu = dnu + pi; %rad end
27 28 29
%evaluate the constant A: A = sign(pi−dnu)*sqrt(r1*r2*(1+cos(dnu)));
30 31 32
%pick a trial value of z: z = pi;
21
33 34
%Functions for C, S, C' (aka dCz), S' (aka dSz):
35 36
[C S dCz dSz] = CSEqs(z);
37 38 39
%Determine y: y = r1+r2−A*(1−z*S)/sqrt(C);
40 41 42
%Determine x: x = sqrt(y/C);
43 44 45
%Calculate numerical time of flight, tof: tof = (xˆ3*S+A*sqrt(y))/sqrt(mu); %TU
46 47 48 49 50 51
%Begin Newton's method: count = 1; while(abs(TOF−tof)>0.001&&count<200000) %Calculate dt/dz: dtz = (xˆ3*(dSz−(3*S*dCz)/(2*C))+A/8*(3*S*sqrt(y)/C+A/x))/sqrt(mu);
52
%Update z −−> z(2) = z(1) − t/(dt/dz) = z(1) − dz: z = z + (TOF−tof)/dtz;
53 54 55
%Calculate C, S, C' (aka dCz), S' (aka dSz): [C S dCz dSz] = CSEqs(z);
56 57 58
%Determine y: y = r1+r2−A*(1−z*S)/sqrt(C);
59 60 61
%Determine x: x = sqrt(y/C);
62 63 64
%Calculate numerical time of flight, tof: tof = (xˆ3*S+A*sqrt(y))/sqrt(mu); %TU count = count+1;
65 66 67 68
end
69 70 71 72 73
%Calculate f, g, gdot: f = 1−y/r1; g = A*sqrt(y/mu); gdot = 1−y/r2;
74 75 76 77
%Compute V1 and V2: V1 = (1/g)*(R2−f*R1); %DU/TU V2 = (1/g)*(gdot*R2−R1); %DU/TU
78 79
1 2 3
end
% CSEqs.m − calculates C, S, C'=dCz, and S'=dSz for the universal variable % method in Gauss' problem % author: Jason Runkle
4
22
5
function [C S dCz dSz] = CSEqs(z)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
if z<−1 C = (1−cosh(sqrt(−z)))/z; S = (sinh(sqrt(−z))−sqrt(−z))/sqrt((−z)ˆ3); dSz = 1/(2*z)*(C−3*S); dCz = 1/(2*z)*(1−z*S−2*C); elseif z<1 C = 1/2−z/24+zˆ2/720−zˆ3/40320; %if −1≤z<1 S = 1/6−z/120+zˆ2/5040; dSz = 1/120+2*z/5040−3*zˆ2/362880; dCz = 1/24+2*z/720−3*zˆ2/40320; else C = (1−cos(sqrt(z)))/z; %if z≥1 S = (sqrt(z)−sin(sqrt(z)))/sqrt(zˆ3); dSz = 1/(2*z)*(C−3*S); dCz = 1/(2*z)*(1−z*S−2*C); end
23