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.

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

The `predict`

command predicts the state and state
estimation error covariance of an `extendedKalmanFilter`

, `unscentedKalmanFilter`

or `particleFilter`

object at the next time step. To
implement the extended or unscented Kalman filter algorithms, use the
`predict`

and `correct`

commands together. If the current output measurement exists, you
can use `predict`

and `correct`

. If the
measurement is missing, you can only use `predict`

. For information
about the order in which to use the commands, see Using predict and correct Commands.

```
[PredictedState,PredictedStateCovariance]
= predict(obj)
```

```
[PredictedState,PredictedStateCovariance]
= predict(obj,Us1,...Usn)
```

`[`

predicts state estimate and state estimation error covariance of an extended or
unscented Kalman filter, or particle filter object `PredictedState`

,`PredictedStateCovariance`

]
= predict(`obj`

)`obj`

at the
next time step.

You create `obj`

using the `extendedKalmanFilter`

, `unscentedKalmanFilter`

or `particleFilter`

commands. You specify the state
transition function and measurement function of your nonlinear system in
`obj`

. You also specify whether the process and measurement
noise terms are additive or nonadditive in these functions. The
`State`

property of the object stores the latest estimated
state value. Assume that at time step `k`

,
`obj.State`

is $$\widehat{x}[k|k]$$. This value is the state estimate for time `k`

,
estimated using measured outputs until time `k`

. When you use the
`predict`

command, the software returns $$\widehat{x}[k+1|k]$$ in the `PredictedState`

output. Where $$\widehat{x}[k+1|k]$$ is the state estimate for time `k+1`

, estimated
using measured output until time `k`

. The command returns the state
estimation error covariance of $$\widehat{x}[k+1|k]$$ in the `PredictedStateCovariance`

output. The
software also updates the `State`

and
`StateCovariance`

properties of `obj`

with
these corrected values.

Use this syntax if the state transition function *f* that you
specified in `obj.StateTransitionFcn`

has one of the following forms:

`x(k) = f(x(k-1))`

— for additive process noise.`x(k) = f(x(k-1),w(k-1))`

— for nonadditive process noise.

Where `x`

and `w`

are the state and
process noise of the system. The only inputs to *f* are the states
and process noise.

`[`

specifies
additional input arguments, if the state transition function of the
system requires these inputs. You can specify multiple arguments.`PredictedState`

,`PredictedStateCovariance`

]
= predict(`obj`

,`Us1,...Usn`

)

Use this syntax if your state transition function *f* has
one of the following forms:

`x(k) = f(x(k-1),Us1,...Usn)`

— for additive process noise.`x(k) = f(x(k-1),w(k-1),Us1,...Usn)`

— for nonadditive process noise.

`clone`

| `correct`

| `extendedKalmanFilter`

| `initialize`

| `particleFilter`

| `unscentedKalmanFilter`