Predicting Closest Approach of Apophis

version 1.1.0 (30.1 MB) by David Eagle
MATLAB script for predicting close approaches between the asteroid Apophis and Earth.


Updated Thu, 13 Jan 2022 19:27:28 +0000

View License

This MATLAB script demonstrates how to interact with a typical asteroid ephemeris file created with the JPL Horizons System located at
Both the asteroid and planetary ephmeris implemented in this script use JPL/NAIF MICE routines to evaluate the ephemerides. Platform-specific versions (Windows, Mac, etc.) of the required MICE mex file are available at
This MATLAB script uses Brent's method of minimization to predict close approach (minimum distance) between Earth and Apophis. The software will request a close approach search duration in days. It will also allow the user to enforce a minimum distance criterion in units of Astronomical Units.
For example, here are close approach conditions for the Apophis encounter in April 2029.
time and conditions at closest approach
calendar date 13-Apr-2029
TDB time 21:46:12.683
TDB Julian date 2462240.40709124
geocentric distance 0.00025409 AU
geocentric distance 38011.48712644 kilometers
It is suggested that users create a unique directory for this application and copy all files from the zip archive to this directory. Log in to this directory from within MATLAB and run the script from there by typing cae2apophis at the command line.
PDF documentation for the Mathworks File Exchange submission "Closest Approach Between the Earth and Heliocentric Objects" is included.

Cite As

David Eagle (2022). Predicting Closest Approach of Apophis (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2019b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!