Question: Instructions: Complete Problem 1 and Problem 2 below. Create a single script (.m file) to complete this assignment, plus such separate function files (.m file(s))
Instructions:
Complete Problem 1 and Problem 2 below.
Create a single script (.m file) to complete this assignment, plus such separate function files (.m file(s)) as are requested in the prompts. Unless directed otherwise, use meaningful variable names for each variable; do not use the default variable ans to store your results. For this assignment do not suppress your output with semi-colons (;). The main script code for each problem (i.e. Problem 1 and Problem 2) should be in a separate cell of your script, using the cell mode feature of MATLAB.
Do not use global variables for this assignment unless otherwise requested for a specific variable (i.e. for one of the variables in Problem 2).
Please remember to follow the Programming Style Convention on Canvas. When complete, please submit your code to the dropbox on Canvas; the grader will run it to view your output. Name your script like this: username_assignment3.m (example: bjs5332_assignment3.m). You may name your function files however you like, as long as the name(s) for the function file(s) are descriptive, and as long as the name(s) include your access ID and the assignment number. Your submission must consist of a single script, plus the function file you create for Problem 1 and the function file you create for Problem 2.
Problem 1
An engineer is examining the rotation of a satellite in outer space. In a given initial coordinate system (frame) A, the position of the satellite can be expressed generically as:
| r A = [ r A1 r A2 r A3 ] | (1) |
After a rotation around a generic satellite axis in frame A, the position of the satellite can be generically expressed in frame B as
| r B = [ r B1 r B2 r B3 ] | (2) |
In the specific case of a rotation from frame A to frame B about the satellite's original 2-axis, the relationship between r A and r B can be expressed as
| r B = [ r A1 cos ( ) r A3 sin ( ) r A2 r A3 cos ( ) + r A1 sin ( ) ] | (3) |
where is the angle of rotation around the satellite's original 2-axis. Note that r B is a 3 x 1 column vector just like r A was.
For a given satellite, it is known that:
- r A = [ 4 2 3 ] m
- = 0.4 rads.
Calculate r B under the assumption of a rotation around the satellite's original 2-axis (i.e. use Eqtn. 3). To do this, write a MATLAB script to:
- Allocate the values of r A (as an array) and .
- Call a programmer-defined function, sending the values of r A and to it as function input variables.
- Receive the output of a programmer-defined function, accepting the value of r B from it as a function output variable.
Write a programmer-defined function (as a separate file) to:
- Accept the values of r A and as function input variables
- Calculate r B. Use array operations to manipulate the values of r A when necessary do not allocate the elements of r A or r B as scalar variables.
- Return the value r B as a function output variable
Don't forget to label the units in your comments.
Problem 2
Two key pieces of information in orbital mechanics relates to the size and shape of an orbit. The size of an orbit is described by its semi-major axis a. The shape of an orbit is given by its eccentricity e.
One angular position of a satellite is known as the true anomaly , which represents the satellite's angular position relative to the location on the orbit closest to the central gravitational source. (This location closest to the central gravitational source is known as periapsis.)
The semi-latus rectum p of an orbit is a useful piece of information for calculating other orbital parameters. Geometrically, the semi-latus rectum p is the length of its position vector when true anomaly is 90 deg (or, geometrically equivalent, 270 deg). The semi-latus rectum p of an orbit is given by the equation
| p = a ( 1 e 2 ) | (4) |
The scalar position r of a satellite can then be given as
| r = p 1 + e cos ( ) | (5) |
In addition, the scalar velocity v of a satellite is given as
| v = ( 2 r 1 a ) | (6) |
where is the standard gravitational parameter of the orbit's central gravitational source (a physical constant). Observe that the satellite's position and velocity are ultimately dependent on the satellite's angular position on the orbit relative to periapsis.
For a given satellite, it is known that:
- The semi-major axis a of the orbit is 15,000 km.
- The eccentricity e of the orbit is 0.3 (unitless).
- The true anomaly of the satellite at a given point in time on the orbit is 45 deg.
- The standard gravitational parameter of the central gravitational source for the orbit is 3.986 x 105 km3/sec2.
Calculate the scalar position r and scalar velocity v of the satellite on this orbit at the time associated with the satellite's true anomaly (i.e. use Eqtns. 1, 2, and 3, in that order). To do this, write a MATLAB script to:
- Declare the value of to be a global variable.
- Allocate the values of a, e, , and .
- Call a programmer-defined function, sending the values of a, e, and to it as function input variables. (Remember, should be a global variable, so do not pass the value of as a function input variable.)
- Receive the output of a programmer-defined function, accepting the values of r and v from it as function output variables. (Note that you are not being asked to return the value of p.)
Write a programmer-defined function (as a separate file) to:
- Accept the value of as a global variable (not as a function input argument).
- Accept the values of a, e, and as function input variables.
- Calculate the values of p, r, and v.
- Return the values of r and v as function output variables. (Note that you are not being asked to return the value of p.)
Don't forget to label the units in your comments.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
