sftools MATLAB

MATLAB tools for estimation, modeling, and plotting.

Getting started

Installation

The easiest way to install is to download the toolbox package (.mltbx) and open it in MATLAB. This package requires MATLAB R2025a or newer.

Alternatively, clone or download the sftools-matlab repository and add its root to the MATLAB path:

addpath('/path/to/sftools-matlab')

This adds the repository to the path for the current MATLAB session.

The toolbox is accessed through the sftools namespace. The built-in functionality requires only base MATLAB; Optimization Toolbox is optional. User-supplied callbacks may require additional toolboxes.

A first estimate

Run the following in MATLAB. It creates a linear observation model, simulates a noisy observation, and computes a weighted least-squares estimate.

stream = RandStream('mt19937ar', 'Seed', 0);
model = sftools.createObservationModel('linear', eye(2), diag([.1, .2]));
truth = [1; 2];
measurement = model.random(truth, 1, stream);
estimate = sftools.estimators.wls(model, measurement);
disp('Mean:')
disp(estimate.mean())
disp('Covariance:')
disp(estimate.cov())

The example prints:

Mean:
    1.1700
    2.8201

Covariance:
    0.1000         0
         0    0.2000


States and observations are columns, and MATLAB indices are one-based. GaussianState exposes its mean and covariance through mean() and cov().

Next steps

Read the dimension conventions and the tracking example.