Skip to content

Jakayla-R/Astrodynamics

Repository files navigation

A collection of MATLAB code examples for various astrodynamics topics, including spacecraft trajectories, navigation, and optimization.

Range = Range Estimation

(Seq_Est) Sequential Estimation:
This code demonstrates sequential state estimation where I process range measurements as they arrive over time to track a moving object. I simulate a target with constant velocity, generate noisy range observations at each time step, then update the position estimate sequentially as new data comes in. The estimation updates the state by correcting in the direction of the range residual. In practice, you'd implement this as a Kalman filter with proper prediction and update steps, process noise modeling, and measurement covariance weighting. Sequential estimation is how real-time tracking systems work, processing sensor data on the fly rather than waiting to batch process everything. This approach is essential for onboard navigation systems or ground-based tracking where you need current state estimates for operational decisions, like commanding thruster firings or updating collision avoidance predictions

(Angles_Only)Angles-Only Measurements:
This code simulates a basic angles-only tracking scenario where you're trying to estimate the direction to a distant object, like a satellite or debris, using only angular measurements from a ground-based sensor. The true target is at 30 degrees azimuth and 20 degrees elevation, but the sensor has measurement noise with a 2-degree standard deviation. I add Gaussian noise to both the azimuth and elevation measurements to simulate real sensor errors from atmospheric refraction, mechanical jitter, or digitization. The code then estimates the target direction using these noisy measurements. In reality, you'd use this as input to a tracking filter like an Extended Kalman Filter that would fuse multiple noisy measurements over time to improve the estimate and potentially extract range information through triangulation or motion dynamics. This is relevant for optical tracking of satellites where you don't have range data initially, or for bearings-only target motion analysis in space surveillance. The simple direct estimation here would be the first step before implementing something more sophisticated like batch least squares or sequential filtering to refine the state estimate.

(Batch_Est)Batch Estimation:
This code demonstrates batch least squares orbit determination using range measurements from a tracking station. I simulate ten range observations over time showing the spacecraft moving away from the sensor, then use batch processing to estimate the orbital state, specifically position and velocity components. The algorithm sets up a linear system relating the measurements to the state parameters and solves it all at once using least squares, which minimizes the residuals between predicted and observed ranges. This is how you'd process tracking data from multiple ground stations to refine an orbit estimate after the fact, like determining a satellite's trajectory from a pass's worth of observations. In practice, you'd include measurement weights, iterate with a nonlinear solver since orbital dynamics aren't linear, and process range rate or angles alongside range. Batch estimation gives you the best-fit orbit through all your data simultaneously, which is more accurate than sequential filtering for post-mission analysis but requires storing all measurements.

(PO)Periodic Orbits

(RTBP)Restricted 3-Body Problem:
This code simulates the circular restricted three-body problem for the Earth-Moon system, where a spacecraft moves under the gravitational influence of two massive bodies. I use the normalized rotating frame where Earth and Moon are fixed on the x-axis and the mass ratio mu defines their relative masses. The equations of motion include gravitational attractions from both primaries plus Coriolis and centrifugal terms from the rotating frame. I propagate the trajectory from initial conditions and plot the spacecraft path in the rotating frame. This is fundamental for designing missions to Lagrange points like L1 or L2, planning lunar transfers using low-energy trajectories, or analyzing halo orbits for space telescopes. The RTBP reveals complex dynamics including periodic orbits, chaos, and transfer manifolds that you can't capture with simple two-body mechanics, making it essential for interplanetary mission design and libration point missions.

(PSO)Particle Swarm Optimization:
This code implements particle swarm optimization to solve trajectory design or mission planning problems. PSO is a nature-inspired algorithm where a swarm of particles explores the solution space, each tracking its personal best and being attracted toward the global best found by the swarm. I initialize 30 particles with random positions and velocities, then iterate through generations where particles update based on cognitive attraction to their own best solution and social attraction to the swarm's best. The inertia weight and acceleration coefficients control exploration versus exploitation. In this example I'm minimizing a simple quadratic, but for spacecraft applications you'd use PSO to optimize things like low-thrust trajectory design, constellation phasing, or multi-objective mission trade studies where gradient-based methods struggle. PSO is particularly powerful for non-convex problems with multiple local minima, making it valuable for complex astrodynamics optimization where you need robust global search without requiring analytical gradients.

(BVP)Boundary Value Problem for Orbital Transfer:
This code solves a two-point boundary value problem for spacecraft trajectory design. Unlike initial value problems where you propagate forward from known initial conditions, BVPs specify constraints at both the start and end of the trajectory, then solve backwards to find the velocity or control needed to connect them. I set up the equations of motion with Earth's gravitational acceleration, define initial position and velocity, then use MATLAB's bvp4c solver to find a trajectory that satisfies boundary conditions at both endpoints. This is essential for transfer orbit design where you know where you start and where you need to end up, like going from LEO to GEO, but need to solve for the delta-V required. The code plots the 3D trajectory and would typically be extended with specific boundary conditions like matching orbital elements or rendezvous constraints. It's the computational backbone of Lambert's problem and other orbit transfer calculations where you're designing maneuvers to hit precise targets.

(RPO)Rendevous & Proximity Operations:
This code simulates rendezvous and proximity operations between a chaser spacecraft and a target, like a servicing vehicle approaching the ISS. I set up initial position and velocity states for both vehicles, then propagate their trajectories under Earth's gravitational influence using ode45. The dynamics function computes the equations of motion including gravitational acceleration and would include control inputs for the chaser's thrusters to execute approach maneuvers. The code plots both trajectories in 3D to visualize the relative motion. In a full implementation, you'd add guidance algorithms like the Clohessy-Wiltshire equations for relative motion, implement thruster firing logic to null out closing velocity, and add collision avoidance constraints. This framework handles the orbital mechanics side of RPO, which is critical for docking operations, on-orbit servicing, or debris removal where you need precise control of the relative state between two spacecraft operating in close proximity.

About

A collection of MATLAB code examples for various astrodynamics topics, including spacecraft trajectories, navigation, and optimization.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages