Main Content

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.

Use this `predict`

command for online state
estimation using real-time data. When data is not available in real time, to compute the
K-step ahead output of an identified model, use `predict`

for offline estimation.

`[`

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.

`correct`

| `clone`

| `extendedKalmanFilter`

| `unscentedKalmanFilter`

| `particleFilter`

| `initialize`

| `residual`