Spatial Math Toolbox


This toolbox contains functions and classes to represent orientation and pose in 2D and 3D (SO(2), SE(2), SO(3), SE(3)) as matrices, quaternions, twists, triple angles, and matrix exponentials. The Toolbox also provides functions for manipulating and converting between datatypes such as vectors, homogeneous transformations and unit-quaternions which are necessary to represent 3-dimensional position and orientation.



Installing the Toolbox

This Toolbox comes bundled with the Robotics Toolbox for MATLAB but if you want to use it by itself, please follow any of the following recipes.

Install from MATLAB Desktop

From inside MATLAB choose the Home tab, then Add-Ons/Get Add-Ons which will bring up the Add-On Explorer window.  Search for “spatial math”, click on the icon and follow the rest of the installation process.

This pulls down the latest code from GitHub. The Toolbox documentation appears in the MATLAB help browser under Supplemental Software.

Install from .mltbx file

  1. Download the following file which is the latest build on GitHub
  2. From within the MATLAB file browser double click on each file, it will install and configure the paths correctly


Clone source from GitHub

GitHubFrom the command line:
git clone smtb

Then inside MATLAB add these folders to your path:

>> addpath smtb

This will work for just the current session.  You can repeat this command every session, automate it by adding it to your MATLAB startup.m script, or use pathtool to save the current path configuration away for next time.


  • The book Robotics, Vision & Control, second edition (Corke, 2017), particularly Chapter 2, illustrates many functions included in this Toolbox.
  • Download the manual (PDF) which is fully-hyperlinked and auto-generated from the comments in the MATLAB code and is fully hyperlinked.

SMTB manual

Toolbox history

This Toolbox was refactored from The Robotics Toolbox for MATLAB ®  in 2018. The Robotics Toolbox started as a bunch of functions to help me during my PhD study, and the first release was in 1995 along with the first published paper.  It ended up as a bunch of robotic-specific functions (kinematics, path planning etc) and a set of very general functions that dealt with spatial math (2D and 3D position, orientation and pose).  My hope is that one way MathWorks will build this into core MATLAB…