Main Content

Particle filter object for online state estimation

A particle filter is a recursive, Bayesian state estimator that uses discrete particles to approximate the posterior distribution of an estimated state. It is useful for online state estimation when measurements and a system model, that relates model states to the measurements, are available. The particle filter algorithm computes the state estimates recursively and involves initialization, prediction, and correction steps.

`particleFilter`

creates an object for online state estimation of a
discrete-time nonlinear system using the discrete-time particle filter algorithm.

Consider a plant with states *x*, input *u*, output
*m*, process noise *w*, and measurement
*y*. Assume that you can represent the plant as a nonlinear
system.

The algorithm computes the state estimates $$\widehat{x}$$ of the nonlinear system using the state transition and measurement likelihood functions you specify.

The software supports arbitrary nonlinear state transition and measurement models, with arbitrary process and measurement noise distributions.

To perform online state estimation, create the nonlinear state transition function and
measurement likelihood function. Then construct the `particleFilter`

object using these nonlinear functions. After you create the object:

Initialize the particles using the

`initialize`

command.Predict state estimates at the next step using the

`predict`

command.Correct the state estimates using the

`correct`

command.

The prediction step uses the latest state to predict the next state based on the state transition model you provide. The correction step uses the current sensor measurement to correct the state estimate. The algorithm optionally redistributes, or resamples, the particles in the state space to match the posterior distribution of the estimated state. Each particle represents a discrete state hypothesis of these state variables. The set of all particles is used to help determine the state estimate.

creates a particle filter object for online state estimation of a discrete-time
nonlinear system. `pf`

= particleFilter(`StateTransitionFcn`

,`MeasurementLikelihoodFcn`

)`StateTransitionFcn`

is a function that
calculates the particles (state hypotheses) at the next time step, given the
state vector at a time step. `MeasurementLikelihoodFcn`

is a
function that calculates the likelihood of each particle based on sensor
measurements.

After creating the object, use the
`initialize`

command to initialize the
particles with a known mean and covariance or uniformly distributed particles
within defined bounds. Then, use the `correct`

and `predict`

commands to update
particles (and hence the state estimate) using sensor measurements.

`initialize` | Initialize the state of the particle filter |

`predict` | Predict state and state estimation error covariance at next time step using extended or unscented Kalman filter, or particle filter |

`correct` | Correct state and state estimation error covariance using extended or unscented Kalman filter, or particle filter and measurements |

`getStateEstimate` | Extract best state estimate and covariance from particles |

`clone` | Copy online state estimation object |

[1] T. Li, M. Bolic, P.M. Djuric,
"Resampling Methods for Particle Filtering: Classification, implementation, and
strategies," *IEEE Signal Processing Magazine*, vol. 32, no. 3, pp.
70-86, May 2015.