*kf
by An Uncommon Lab

Basic Filters

While *kf includes tools for creating and running detailed filters, it also includes a set of generic filters that one can invoke without any setup. These include a particle filter, extended information filter, linear Kalman filter, and unscented Kalman filter, providing the simplest possible interfaces for performing a single step of propagation and correction. As the simplest example, consider a linear Kalman filter, which can be called as:

[x_k, P_k] = lkf(x_km1, P_km1, u_km1, z_k, F_km1, F_u_km1, H_k, Q_km1, R_k);

Further, the framework function kff can be called with a similarly simple interface. For instance, for a basic extended Kalman filter, kff can be called as:

[x_k, P_k] = kff( ...
    t_km1, t_k, x_km1, P_km1, u_km1, z_k, ... % Signals
    f, F_km1, Q_km1, ...                      % Prediction
    h, H_k, R_k);                             % Observation

All of these variables are discussed in the nomenclature section.

Though kff can do much more, here it functions as the simplest possible interface for an extended Kalman filter.

Simulations for these filters often look something like so:

for k = 1:ns
 
    x_true_k = f_true(t(k-1), x_true_km1, ...); % Update the true state.
    z_k      = h_true(t(k), x_true_k, ...);     % Create the noisy measurement.
 
    % Update the estimate from k-1 to k.
    [x_hat_k, P_k]  = <filter>(t_km1, dt, x_hat_km1, P_km1, z_k, ...);
  
end

Next Steps

To learn more about each individual filter, click the links to the left under “Basic Filters”.

To learn more about the framework functions, see the Frameworks page or the corresponding tutorial.