The state of the spacecraft is the position and the velocity, [x, y, z, vx, vy, vz], which defines
where the spacecraft is at this time. In order to figure out where the spacecraft will be in the
future, we can take the time derivative of the state and integrate it over time. The integration will
take place in part 2 using ode45 to solve the equation.
Build a derivative function two-body.m that calculates the time derivative of the spacecraft
position (x, y, z) and velocity (vx, vy, vz). Remember that the derivative of a position is the
velocity and that the derivative of a velocity is an acceleration. The accelerations in x, y and z
can be found using Equation 7.
Besides the position and the velocity inputs, the function will also need a time vector input, as well the value of µ. The time vector will not be used in the velocity and acceleration
calculations, but it will be needed for the propagation function later. The function returns a
vector with velocity elements (vx, vy, vz) and acceleration elements (ax, ay, az).
function [partials] = two-body(time, [x y z vx, vy, vz], µ)
partials = [vx vy vz µ
r3 ]. (15)
Figure 2: The spacecraft is orbiting the Earth in a Low Earth Orbit.
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.
%[x y z vx vy vz]=A;