### Matlab Exercises

This file contains basic exercises to help you become familiar with Matlab's features.

### Rotation matrices

The file rotex.m is a script file that computes some example rotation matrices. It uses the function files R1.m, R2.m, and R3.m. These three files compute the simple rotation matrices associated with "1", "2", and "3" rotations, respectively.

You should download these 4 files, put them in your Matlab directory, and type rotex at the Matlab prompt to see how it works.

### Position and velocity <-> Orbital elements

The file rv2oeex.m is a script file that does the calculations for a specific problem of converting position and velocity vectors to orbital elements. It calls two Matlab functions rv2oe.m and oe2rv.m to convert between position and velocity and orbital elements. In these functions, oe is a 6x1 matrix containing the semimajor axis, eccentricity, inclination, argument of periapsis, right ascension of the ascending node, and true anomaly (at epoch). A variation on oe2rv.m is oee2rv.m. The difference is that the 6th orbital element in the oee2rv version is eccentric anomaly at epoch instead of true anomaly.

### SEZ coordinates -> Position and velocity

The file razel2rv.m is a Matlab function that converts rho, rhodot, Az, Azdot, El, and Eldot to position and velocity vectors in the IJK frame. You do need to know local sidereal time, Earth rotation rate (relative to inertial space), site latitude, and Earth radius.

The file razelex.m is a Matlab script file that does an example, including making a plot of the three-dimensional trajectory intersecting a sphere.

• Read a Two-Line Element Set and put the classical orbital elements into a 6x1 matrix: tle2oee.m. Note that the 6th orbital element is eccentric anomaly at epoch. A version with true anomaly at epoch as the 6th element is available in the zip file below.
• Download a collection of useful astrodynamics functions. They're zipped up in astro.zip.
• Read my “manifesto” on numerical integration using Matlab.