-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathrv_from_r0v0_ta.m
31 lines (28 loc) · 1.04 KB
/
rv_from_r0v0_ta.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function [r,v] = rv_from_r0v0_ta(r0, v0, dt, mu)
%% This function computes the state vector (r,v) from the
% initial state vector (r0,v0) and the change in true anomaly.
%
% Jeremy Penn
% 19/11/2017
%
% function [r,v] = rv_from_r0v0_ta(r0, v0, dt, mu)
%
% Inputs: o mu - gravitational parameter (km^3/s^2)
% o r0 - initial position vector (km)
% o v0 - initial velocity vector (km/s)
% o dt - change in true anomaly (degrees)
% o r - final position vector (km)
% o v - final velocity vector (km/s)
%
% Output: o r - new position vector (km)
% o v - new velocity vector (km/s)
%
% Required: f_and_g_ta, fDot_and_gDot_ta
%
%...Compute the f and g functions and their derivatives:
[f, g] = f_and_g_ta(r0, v0, dt, mu);
[fdot, gdot] = fDot_and_gDot_ta(r0, v0, dt, mu);
%...Compute the final position and velocity vectors:
r = f*r0 + g*v0;
v = fdot*r0 + gdot*v0;
end