Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function [r, v] = sv_from_coe(coe,mu) % ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %{ This function computes the state vector (r,v) from the classical orbital elements (coe). mu -

image text in transcribed

% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function [r, v] = sv_from_coe(coe,mu) % ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %{ This function computes the state vector (r,v) from the classical orbital elements (coe). mu - gravitational parameter (km^3;s^2) coe - orbital elements [a e incl Om w TA] where a - semimajor axis (km) e = eccentricity incl = inclination of the orbit (rad) Om = longitude of the ascending node (rad) w = argument of perigee (rad) TA = true anomaly (rad) p - semi-latus rectum (km) h - the magnitude of H (km^2/s) R3_w - Rotation matrix about the z-axis through the angle w R1_i - Rotation matrix about the x-axis through the angle i R3_W - Rotation matrix about the z-axis through the angle Om Q_pX - Matrix of the transformation from perifocal to geocentric equatorial frame rp - position vector in the perifocal frame (km) vp - velocity vector in the perifocal frame (km/s) r - position vector in the geocentric equatorial frame (km) v - velocity vector in the geocentric equatorial frame (km/s)

User M-functions required: none %} % ----------------------------------------------

a = coe(1); e = coe(2); incl = coe(3); Om = coe(4); w = coe(5); TA = coe(6);

p = a*(1-e^2) ; h = sqrt(mu*p) ;

%...Equations 4.45 and 4.46 (rp and vp are column vectors): rp = (h^2/mu) * (1/(1 + e*cos(TA))) * (cos(TA)*[1;0;0] + sin(TA)*[0;1;0]); vp = (mu/h) * (-sin(TA)*[1;0;0] + (e + cos(TA))*[0;1;0]);

%...Equation 4.34: R3_W = [ cos(Om) sin(Om) 0 -sin(Om) cos(Om) 0 0 0 1];

%...Equation 4.32: R1_i = [1 0 0 0 cos(incl) sin(incl) 0 -sin(incl) cos(incl)];

%...Equation 4.34: R3_w = [ cos(w) sin(w) 0 -sin(w) cos(w) 0 0 0 1];

%...Equation 4.49: Q_pX = (R3_w*R1_i*R3_W)';

%...Equations 4.51 (r and v are column vectors): r = Q_pX*rp; v = Q_pX*vp;

%...Convert r and v into row vectors: r = r'; v = v';

end % ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

__________________________________________________________________________________________________________-

% ~~~~~~~~~~~~~~~~~~~~~~~~ function dYdt = twobodyEOM2D(t,Y,mu) % ------------------------ %{ This function calculates first and second time derivatives of r governed by the equation of two-body 2D motion Y - column vector containing r and v at time t dYdt - column vector containing drdt and dvdt at time t

User M-functions required: none %} % ~~~~~~~~~~~~~~~~~~~~~~~~

rvec = Y(1:2); vvec = Y(3:4);

r = sqrt(rvec(1)^2+rvec(2)^2) ;

rdotvec = vvec ; vdotvec = -mu/r^3*rvec ;

dYdt = [rdotvec; vdotvec]; end

Consider a spacecraft around the Earth with the following initial conditions (km and degrees): a1 10000 0.3 30 where 398600 km2/s2 -1 100 60 1-60 The objective of this problem is to compute the position and velocity vectors of the spacecraft 2h after these initial conditions. We will use 3 different methods. Method 1: numerical integration 1.a) By hand (calculator) convert to position and velocity in km and km/s. 1.b) Use the Matlab sv_from_coe function (posted on Blackboard) to redo question 1.a). Verify that your hand calculations match your calculations 1.c) Using Matlab's ode45, integrate the spacecraft initial conditions (found above) for 2h. Assume an integration tolerance (AbsTol and RelTol parameters for ode45) of 1e-13. It is recommended to use the twobodyEOM function you developed in Problem 2 of HW1. 1.d) Extract and show the final position and velocity vectors from the ode45 output. computer calculation. jnital conditions (found above Consider a spacecraft around the Earth with the following initial conditions (km and degrees): a1 10000 0.3 30 where 398600 km2/s2 -1 100 60 1-60 The objective of this problem is to compute the position and velocity vectors of the spacecraft 2h after these initial conditions. We will use 3 different methods. Method 1: numerical integration 1.a) By hand (calculator) convert to position and velocity in km and km/s. 1.b) Use the Matlab sv_from_coe function (posted on Blackboard) to redo question 1.a). Verify that your hand calculations match your calculations 1.c) Using Matlab's ode45, integrate the spacecraft initial conditions (found above) for 2h. Assume an integration tolerance (AbsTol and RelTol parameters for ode45) of 1e-13. It is recommended to use the twobodyEOM function you developed in Problem 2 of HW1. 1.d) Extract and show the final position and velocity vectors from the ode45 output. computer calculation. jnital conditions (found above

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Accidental Data Scientist

Authors: Amy Affelt

1st Edition

1573877077, 9781573877077

More Books

Students also viewed these Databases questions

Question

the Sarbanes - oxley act of 2002

Answered: 1 week ago