Main Content

Distances between current and predicted measurements of tracking filter

computes the normalized distances between one or more current object measurements,
`dist`

= distance(`filter`

,`zmeas`

)`zmeas`

, and the corresponding predicted measurements computed by the
input `filter`

. Use this function to assign measurements to
tracks.

This distance computation takes into account the covariance of the predicted state and the measurement noise.

specifies additional parameters that are used by the `dist`

= distance(`filter`

,`zmeas`

,`measparams`

)`MeasurementFcn`

of the filter.

If filter is a `trackingKF`

or `trackingABF`

object, then you cannot use this syntax.

The `distance`

function computes the normalized distance between the
filter object and a set of measurements. This distance computation is a variant of the
Mahalanobis distance and takes into account the residual (the difference between the object
measurement and the value predicted by the filter), the residual covariance, and the
measurement noise.

Consider an extended Kalman filter with state *x* and measurement
*z*. The equations used to compute the residual,
*z*_{res}, and the residual covariance,
*S*, are

*z*_{res} = *z* –
*h*(*x*),

*S* = *R* +
*HPH ^{T}*,

where:

*h*is the measurement function defined in the`MeasurementFcn`

property of the filter.*R*is the measurement noise covariance defined in the`MeasurementNoise`

property of the filter.*H*is the Jacobian of the measurement function defined in the`MeasurementJacobianFcn`

property of the filter.

The residual covariance calculation for other filters can vary slightly from the one shown because tracking filters have different ways of propagating the covariance to the measurement space. For example, instead of using the Jacobian of the measurement function to propagate the covariance, unscented Kalman filters sample the covariance, and then propagate the sampled points.

The equation for the Mahalanobis distance,
*d*^{2}, is

*d*^{2} =
*z*_{res}^{T}*S*^{–1}*z*,

The distance function computes the normalized distance,
*d*_{n}, as

*d*_{n} =
*d*^{2} +
log(|*S*|),

where log(|*S*|) is the logarithm of the determinant of residual
covariance *S*.

The log(|*S*|) term accounts for tracks that are
*coasted*, meaning that they are predicted but have not had an update
for a long time. Tracks in this state can make *S* very large, resulting in a
smaller Mahalanobis distance relative to the updated tracks. This difference in distance
values can cause the coasted tracks to incorrectly take detections from the updated tracks.
The log(|*S*|) term compensates for this effect by penalizing such tracks,
whose predictions are highly uncertain.

`clone`

| `correct`

| `correctjpda`

| `initialize`

| `likelihood`

| `predict`

| `residual`