Researchers Test Control Algorithms for NASA SPHERES Satellites with a MATLAB Based Simulator

For NASA, developing satellite trajectory optimization and control algorithms with MATLAB and related toolboxes is about twice as fast as developing them with languages that require everything to be coded from scratch.


Provide a platform for debugging and testing formation flight, autonomous rendezvous, and docking algorithms for satellites


Use MATLAB and Simulink simulation and 3D visualization to verify control algorithms and evaluate test results aboard the International Space Station


  • Algorithms verified via simulation
  • Experimental results visualized in 3D
  • Unique educational opportunity opened
Three SPHERES floating freely in the International Space Station.

Successful execution of spacecraft maneuvers such as formation flight, docking, and autonomous rendezvous requires sophisticated control algorithms. To test these algorithms under realistic operating conditions inside the International Space Station, scientists use Synchronized Position Hold, Engage, Reorient, Experimental Satellites (SPHERES) equipped with propulsion, sensor, communications, and processing systems.

To make the most of limited testing time on the space station, scientists first debug and verify their algorithms on the ground using a simulator developed in MATLAB® and Simulink®. Because most of the scientists who develop algorithms for SPHERES have prior experience with MATLAB, they can get started quickly and easily add new capabilities—for example, to support a new sensor or additional hardware.


Time is a precious resource aboard the space station, so the crew must balance research with the necessary maintenance and operations activities. SPHERES experiments are often scheduled in four-hour blocks. Setup and teardown procedures usually consume the first and last hours, leaving just two hours for experimentation. The group wanted to make the most of limited testing time by enabling scientists on the ground and astronauts on the space station to test and debug algorithms via simulation.

Until recently, scientists relied on a video feed to monitor space station experiments. The low-resolution video feed provided only one perspective, making it difficult to see how the satellites moved in three dimensions. Telemetry data, while useful for postprocessing analysis, is not accessible in real time. The group wanted to enable scientists on the ground and astronauts on the space station to visualize satellite movement from multiple viewpoints.


Scientists use a MATLAB and Simulink based simulator maintained by NASA’s Ames Research Center to verify algorithms before testing them aboard the space station. They visualize the results of SPHERES experiments using Simulink 3D Animation™.

Developed at the Massachusetts Institute of Technology (MIT), the SPHERES simulator uses MATLAB, Simulink, Aerospace Toolbox, and Aerospace Blockset™ to model the dynamics and motion of the three SPHERES satellites in microgravity. The simulator includes submodels of the satellites’ sensors, the propulsion systems, and a positioning system that uses infrared and ultrasonic technology to pinpoint the satellites’ location within the space station test area.

To use the simulator, researchers create a Guest Scientist Program (GSP) module, an implementation of control algorithms in C/ C++ code that can be used without modification both in the simulator and on a SPHERES processor. The simulator accesses the C/C++ code via a MEX-file interface. Scientists can write GSP modules directly in C/C++ or develop them in MATLAB or Simulink and use Embedded Coder® to generate C/C++ code.

Researchers test their control algorithms via simulation. Many use MATLAB to postprocess the results as they debug the code.

The team at NASA Ames worked with NASA’s Johnson Space Center in Houston to install MATLAB, Simulink, and related products on laptops aboard the space station. MATLAB and Simulink passed a rigorous security, performance, and reliability review, and their use on the space station was approved.

The laptop receives the telemetry data from the SPHERES and produces a 3D animation of the live experiment using MATLAB and Simulink 3D Animation. The space station crew and researchers on the ground can control this animation, changing the perspective and other parameters to better visualize the satellites’ movement throughout the test.

Plans are under way to use MATLAB and Simulink on the space station laptops for real-time trajectory planning during SPHERES investigations.


  • Algorithms verified via simulation. Because testing time on the space station is limited, NASA scientists test and refine their ideas via simulation on the ground. The MATLAB and Simulink model captures all relevant characteristics of the satellites and their environment, so the scientists are confident that if code works in simulation it will work in real-world tests.

  • Experimental results visualized in 3D. Previously, the scientists had difficulty determining whether SPHERES satellites were behaving as expected because they only had grainy video. With MATLAB and Simulink 3D Animation, they can instantly see the satellites’ movement and make changes as needed.

  • Unique educational opportunity opened. The MATLAB and Simulink simulator is vital to Zero Robotics, a competition run by MIT in which high school students create and simulate C algorithms to solve a specific challenge with a SPHERES satellite. The winners’ code is used in a live championship conducted by the crew aboard the space station.