Main Content

Create particle filter state estimator

The `stateEstimatorPF`

object 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 an
object that enables the state estimation for a simple system with three state
variables. Use the `pf`

= stateEstimatorPF`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 object, use `initialize`

to
initialize the `NumStateVariables`

and
`NumParticles`

properties. The `initialize`

function sets these two properties based on your inputs.

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

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

`predict` | Predict state of robot in next time step |

`correct` | Adjust state estimate based on sensor measurement |

[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.

`resamplingPolicyPF`

| `initialize`

| `getStateEstimate`

| `predict`

| `correct`