Note: This page has been translated by MathWorks. Please click here

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

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

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

The `correct`

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

, `unscentedKalmanFilter`

or `particleFilter`

object using measured system outputs.
To implement extended or unscented Kalman filter, or particle filter, use the
`correct`

and `predict`

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

and `predict`

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

```
[CorrectedState,CorrectedStateCovariance]
= correct(obj,y)
```

```
[CorrectedState,CorrectedStateCovariance]
= correct(obj,y,Um1,...,Umn)
```

`[`

corrects the state estimate and state estimation error covariance of an extended or
unscented Kalman filter, or particle filter object `CorrectedState`

,`CorrectedStateCovariance`

]
= correct(`obj`

,`y`

)`obj`

using
the measured output `y`

.

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-1]$$. This value is the state estimate for time `k`

,
estimated using measured outputs until time `k-1`

. When you use the
`correct`

command with measured system output
`y[k]`

, the software returns the corrected state estimate $$\widehat{x}[k|k]$$ in the `CorrectedState`

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

, estimated
using measured outputs until time `k`

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

output. The
software also updates the `State`

and
`StateCovariance`

properties of `obj`

with
these corrected values.

Use this syntax if the measurement function *h* that you
specified in `obj.MeasurementFcn`

has one of the following forms:

`y(k) = h(x(k))`

— for additive measurement noise.`y(k) = h(x(k),v(k))`

— for nonadditive measurement noise.

Where `y(k)`

, `x(k)`

, and
`v(k)`

are the measured output, states, and measurement noise
of the system at time step `k`

. The only inputs to
*h* are the states and measurement noise.

`[`

specifies
additional input arguments, if the measurement function of the system
requires these inputs. You can specify multiple arguments.`CorrectedState`

,`CorrectedStateCovariance`

]
= correct(`obj`

,`y`

,`Um1,...,Umn`

)

Use this syntax if the measurement function *h* has
one of the following forms:

`y(k) = h(x(k),Um1,...,Umn)`

— for additive measurement noise.`y(k) = h(x(k),v(k),Um1,...,Umn)`

— for nonadditive measurement noise.

`correct`

command passes these inputs to
the measurement function to calculate the estimated outputs.

`clone`

| `extendedKalmanFilter`

| `initialize`

| `particleFilter`

| `predict`

| `unscentedKalmanFilter`

Was this topic helpful?