Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

**Package: **robotics

Create particle filter state estimator

The particle filter is a recursive, Bayesian state estimator that uses discrete particles to approximate the posterior distribution of the estimated state.

The particle filter algorithm computes the state estimate recursively and involves two steps: prediction and correction. The prediction step uses the previous state to predict the current state based on a given system model. The correction step uses the current sensor measurement to correct the state estimate. The algorithm periodically redistributes, or resamples, the particles in the state space to match the posterior distribution of the estimated state.

The estimated state consists of state variables. Each particle represents a discrete state hypothesis of these state variables. The set of all particles is used to help determine the final state estimate.

You can apply the particle filter to arbitrary nonlinear system models. Process and measurement noise can follow arbitrary non-Gaussian distributions.

For more information on the particle filter workflow and setting specific parameters, see:

creates
a `pf`

= robotics.ParticleFilter`ParticleFilter`

object that enables the state
estimation for a simple system with three state variables. Use the `initialize`

method
to initialize the particles with a known mean and covariance or uniformly
distributed particles within defined bounds. To customize the particle
filter’s system and measurement models, modify the `StateTransitionFcn`

and `MeasurementLikelihoodFcn`

properties.

After you create the `ParticleFilter`

object,
use `robotics.ParticleFilter.initialize`

to initialize the `NumStateVariables`

and `NumParticles`

properties.
The `initialize`

function sets these two properties
based on your inputs.

copy | Create copy of particle filter |

correct | Adjust state estimate based on sensor measurement |

getStateEstimate | Extract best state estimate and covariance from particles |

initialize | Initialize the state of the particle filter |

predict | Predict state of robot in next time step |

[1] Arulampalam, M.S., S. Maskell, N. Gordon, and T. Clapp. "A Tutorial on Particle Filters
for Online Nonlinear/Non-Gaussian Bayesian Tracking." *IEEE Transactions
on Signal Processing.* Vol. 50, No. 2, Feb 2002, pp.
174-188.

[2] Chen, Z. "Bayesian Filtering: From Kalman Filters to
Particle Filters, and Beyond." *Statistics*.
Vol. 182, No. 1, 2003, pp. 1-69.

`robotics.ParticleFilter.correct`

| `robotics.ParticleFilter.predict`

| `robotics.ResamplingPolicy`