Click or drag to resize

Using STK Components with Matlab

The Mathworks product MATLAB supports using Jar files as an external interface. This means that STK Components can be used from within the MATLAB environment. Help from Mathworks is located on their site here.

This topic will show you how to setup and use STK Components with MATLAB to perform some simple analysis.


You must have the following prerequisites met to integrate STK Components with MATLAB:

  • STK Components, Release 2009r3 or later

  • A valid STK Components license

  • Mathwork's MATLAB product, version R2009a or later installed

  • Sample MATLAB files located in the Examples\MATLAB directory of the STK Components install


This section will show you how to set up MATLAB using STK Components and the sample files provided with the STK Components Install.

Configuring the STK Components License

  1. Start MATLAB.

  2. Within MATLAB, change directories to the MATLAB directory in your STK Components install: Examples\Matlab

  3. Open the LoadComponents.m file in the MATLAB editor.

  4. Open your STK Components License file in any text editor (the MATLAB editor will work fine here too).

  5. In the LoadComponents.m file, update the MATLAB string with your license information. Note that the MATLAB string containing your license must be an exact match to the license file you received from AGI, including all XML elements.

  6. Save the LoadComponents.m file.

Running the Demo

  1. Open the RunComponentDemo.m file in the MATLAB Editor.

  2. This file runs all the demos, after first loading the components libraries. You can run this file to execute all the demos at once, or can also step through each file using the Matlab debugger, seeing what each line does.

STK Components MATLAB Example Files
  • RunComponentDemo.m - Loads each file in order, running the entire demo.

  • LoadComponents.m - Loads STK Components into MATLAB, and activates the license. You can clear the imported Java classes using the clear java MATLAB command.

  • NavigationExample.m - Example STK Components code that sets up and runs the navigation examples, using the Navigation Accuracy Library. The example calculates Dilution of Precision (DOP), and assessed and predicted navigation accuracy for a single site. If you don't have a license for the Navigation Accuracy Library, simply comment out the NavigationExample line in the RunComponentDemo.m file.

  • DGLExample.m - This file contains example DGL code that creates an SGP4 propagator from a TLE, and a facility. It then calculates access over a three day period from that facility to the satellite using an ElevationAngleConstraint. The access times are then output to the MATLAB Command Window.