Plot Satellite Orbits in MATLAB

Use MATLAB to compute and visualize Keplerian orbits and ground tracks from first principles.

High School Orbital Mechanics 2–3 weeks
Last reviewed: March 2026

Overview

MATLAB has been the dominant tool for engineering computation in aerospace for over 40 years. From the flight dynamics team at Boeing to the guidance team at JPL, MATLAB scripts and Simulink models are core parts of the engineering workflow. In this project you will use MATLAB to solve one of the most fundamental problems in astrodynamics: given a set of classical orbital elements, where is the satellite right now, and where will it be over the next 24 hours?

You will implement the mathematical conversion from Keplerian orbital elements (the six numbers that fully describe an orbit) to Cartesian position and velocity vectors. Then you will propagate the orbit forward in time, transform position to geographic coordinates, and plot both a 3D orbit around a sphere representing Earth and a 2D ground track on a world map. Along the way you will discover why the ISS at 51.6° inclination covers most populated regions while a sun-synchronous weather satellite at 98° inclination covers the entire planet.

MATLAB is available free to students at most universities and many high schools through institutional licenses—check if your school has access, or use MATLAB Online (free with an academic email). If neither is available, GNU Octave is a free, compatible alternative for all the scripts in this project.

What You'll Learn

  • Define the six classical orbital elements and explain what each one describes physically.
  • Convert orbital elements to Cartesian state vectors using the orbital mechanics transformation.
  • Propagate a Keplerian orbit forward in time using the equations of motion.
  • Transform Earth-centered position vectors to geographic latitude and longitude.
  • Visualize 3D orbits and 2D ground tracks using MATLAB plotting functions.

Step-by-Step Guide

1

Set up MATLAB and verify access

Log in to MATLAB Online at matlab.mathworks.com using your school email (most institutions have free access) or download MATLAB from MathWorks with a student license. Create a new script called orbit_plotter.m. Verify your environment by typing a = 7000e3; disp(a) in the Command Window—you should see 7000000 printed. MATLAB does not require any installation of extra packages for this project.

2

Define orbital elements and Earth constants

At the top of your script, define constants: mu = 3.986e14 (Earth's gravitational parameter, m³/s²), Re = 6371e3 (Earth radius, m). Define orbital elements for the ISS: a = 6771e3 (semi-major axis), e = 0.0006 (eccentricity), i = 51.6*pi/180 (inclination in radians), Omega = 0 (RAAN), omega = 0 (argument of perigee), nu = 0 (true anomaly at epoch). These numbers describe the ISS orbit as of early 2026.

3

Convert orbital elements to state vectors

Write a function oe2rv(a, e, i, Omega, omega, nu, mu) that converts elements to position r and velocity v in the Earth-Centered Inertial (ECI) frame. First compute the perifocal position: p = a*(1-e^2), r_peri = [p*cos(nu)/(1+e*cos(nu)); p*sin(nu)/(1+e*cos(nu)); 0]. Then rotate using three rotation matrices (R3(−Ω) × R1(−i) × R3(−ω)) to get ECI position. Use MATLAB's matrix multiplication operator *. Test by computing the magnitude of r—it should equal a for a circular orbit (e=0) at nu=0.

4

Propagate the orbit over 24 hours

Create a time vector covering 24 hours: t = 0:60:86400 (one step per minute). For each time step, compute the new true anomaly by solving Kepler's equation numerically or using the mean motion approximation: n = sqrt(mu/a^3), M = n*t (mean anomaly), then nu_t = M for near-circular orbits (good approximation when e is small). Call oe2rv at each time step to get the ECI position vector. Store all positions in a 3×N matrix.

5

Plot the 3D orbit around Earth

Draw Earth as a sphere: use [x,y,z] = sphere(50) and surf(Re*x, Re*y, Re*z) with a light blue color map. Hold the plot and add the orbit: plot3(r_eci(1,:), r_eci(2,:), r_eci(3,:), 'r-', 'LineWidth', 2). Add axis labels in km (divide by 1000), set axis equal, and add lighting with light('Position',[1 0 0]). Rotate the view to show the orbital inclination clearly. Export the figure as a PNG for your report.

6

Compute and plot the ground track

Convert ECI positions to geographic coordinates. Account for Earth's rotation: theta_GST = omega_E * t where omega_E = 7.2921e-5 rad/s. Rotate the ECI x-y plane by theta_GST to get ECEF positions, then compute latitude = asin(z/r) and longitude = atan2(y_ecef, x_ecef). Convert to degrees. Plot on a world map using load coastlines; plot(coastlon, coastlat, 'k'), then overlay the ground track as colored dots by time. Identify which countries the ISS passes over in a single day.

Go Further

  • Add the J2 perturbation to your propagator and observe how the RAAN (right ascension of ascending node) drifts westward over days—this is how sun-synchronous orbits are maintained.
  • Plot ground tracks for three different satellites (ISS, Hubble, a GEO communications satellite) on the same world map and compare their coverage patterns.
  • Implement a ground station access calculator: given your city's latitude and longitude, compute all times when a satellite is above 10° elevation during the 24-hour period.
  • Export your ground track data to KML format and visualize it in Google Earth for a compelling visual presentation.