 # Part 2 For this part, you will be using a built-in Matlab function...

## Question

Show transcribed text

## Transcribed Text

Part 2 For this part, you will be using a built-in Matlab function called ode45. Using ode45 with your two-body.m function will allow you to propagate your initial position and velocity in time. Essentially the function ode45 integrates your derivative, Equation 15, over the time interval that you specify to find the new position and velocity of the spacecraft. The initial position and velocity of the spacecraft is: ro = [6678.1363, 0, 0] km (16) U0 = [0, 7.725760634075587, 0] km/s (17) In order to propagate your orbit, use the following tolerances: options=odeset('RelTol',1e-12,'AbsTol',1e-12) This is an example of an ode45 function call: [propagated_time,propagated_pos_vel] time, x y 2 Ux, Uy, vz], options, u) Propagate your position in orbit for one full revolution around the Earth (8147 seconds) and plot your trajectory around the Earth, with Earth in the middle. Note: we have added matlab code to plot a nice Earth. This orbit is circular and equatorial. Part 3 Write a function that returns Va and AV, needed for the transfer to the moon. The function accepts as inputs: the radius of the LEO, the radius of the final orbit of the moon and u. The equations needed for this calculation are given ( 8 to 14). The function header should look like this: [Va, Vb] = HohmannTransfer(initial.radius, final.radius, ) Apply the calculated Va to the last propagated position and velocity from Part 2 and propa- gate until you reach the Moon (433061 seconds). Does this value seem reasonable to you? Give examples of missions where a similar maneuver has been used. X 105 1 0.5 -0.5 -1 1 -1 2 X 105 3 X 105 X [km] 1 Y [km] Figure 3: The spacecraft have ignited its thrusters and performed Va to get into the right position around the moon. Once you reached the moons orbit, another tangential burn is needed for the spacecraft to stay in the orbit. Add the calculated AV1 to the spacecraft's velocity and propagate the moon orbit for a full revolution (the spacecraft needs to return to the same position) around the Earth. Remember the conditions for a Hohmann transfer. Plot the trajectory, to make sure your code is doing the right thing.

## Solution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

function main()
clear all
close all %empty variables in memory then close all windows, pictures etc start fresh
options=odeset('RelTol',1e-12,'AbsTol', 1e-12);
time1=8147; %time it takes for earth to do one revolution in seconds
mu=3.986004415*10^5;
r0=[6678.1363, 0, 0];
v0=[0, 7.725760634075587,0];%
[propagatedtime,propagatedposvel] =ode45(@(t,x)twobody(t,x,mu),[0, time1],[r0, v0]',options);
N=length(propagatedtime); %length of the vector propagatedtime
size(propagatedposvel)
plot3(propagatedposvel(:,1),propagatedposvel(:,2),propagatedposvel(:,3))
% we plot the values x,y,z in 3d
hold on
xlabel('x')
ylabel('y')
zlabel('z')

disp('-------Part 3----------')
options=odeset('RelTol',1e-12,'AbsTol', 1e-12);
a=propagatedposvel(N,:) % propagatedposvel is of size N times 6
% we note that the z component of the velocity is always zero by
% construction of the problem.
% we add dVa to the velocity vector at time 8147 seconds

% we normalize the velocity vector u=1/(a(4)^2+a(5)^2)*[a(4),a(5),0]
%after adding the boost dVa, the velocity is
u=1/(a(4)^2+a(5)^2)*[a(4),a(5),0];
LEO=300;...

By purchasing this solution you'll be able to access the following files:
Solution1.m and Solution2.m.

\$50.00
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

### Find A Tutor

View available MATLAB for Computer Science Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.