Main Content

Track error and NEES

The `trackErrorMetrics`

System object™ provides quantitative comparisons between tracks and known truth
trajectories.

To generate track assignment metrics:

Create the

`trackErrorMetrics`

object and set its properties.Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?.

creates a
`errorMetrics`

= trackErrorMetrics`trackErrorMetrics`

System object with default property values.

sets properties for the `errorMetrics`

= trackErrorMetrics(`Name,Value`

)`trackErrorMetrics`

object using one or more
name-value pairs. For example, ```
metrics =
trackErrorMetrics('MotionModel','constvel')
```

creates a
`trackErrorMetrics`

object with a constant velocity motion model. Enclose
property names in quotes.

To estimate errors, call the track error metrics object with arguments, as if it were a function (described here).

`[`

returns the metrics`posRMSE`

,`velRMSE`

,`posANEES`

,`velANEES`

] = errorMetrics(`tracks`

,`trackIDs`

,`truths`

,`truthIDs`

)

`posRMSE`

– Position root mean squared error`velRMSE`

– Velocity root mean squared error`posANEES`

– Position average normalized-estimation error squared`velANEES`

– Velocity average normalized-estimation error squared

for constant velocity motion at the current time step.
`trackIDs`

is the set of track identifiers for all tracks.
`truthIDs`

is the set of truth identifiers.
`tracks`

are the set of tracks, and `truths`

are
the set of truths. `trackIDs`

and `truthIDs`

are
each a vector whose corresponding elements match the track and truth identifiers found
in `tracks`

and `truths`

, respectively.

The RMSE and ANEES values for different states are calculated by averaging the
errors of all tracks at the current time step. For example, the position RMSE value,
`posRMSE`

, is defined as:

$$\text{posRMSE}=\sqrt{\frac{1}{M}{\displaystyle \sum _{i=1}^{M}\Vert \Delta {p}_{i}{\Vert}^{2}}}$$

where *M* is the total number of tracks with associated truth
trajectories in the current time step, and

$$\Delta {p}_{i}={p}_{track,i}-{p}_{truth,i}$$

is the position difference between the position of track *i*,
*p*_{track,i},
and the position of the corresponding truth,
*p*_{truth,i},
at the current time step. The RMSE values for other states (`vel`

,
`pos`

, `acc`

, and `yawRate`

) are
defined similarly.

The position ANEES value, `posANEES`

, is defined as:

$$\text{posANEES}=\frac{1}{M}{\displaystyle \sum _{i=1}^{M}\Delta {p}_{i}{}^{T}{C}_{p,i}^{-1}\Delta {p}_{i}}$$

where
*C*_{p,i}
is the covariance matrix corresponding to the position of track *i* at
the current time step. The ANEES values for other states (`vel`

,
`pos`

, `acc`

, and `yawRate`

) are
defined similarly.

To enable this syntax, set the `ErrorFunctionFormat`

property to
`'built-in'`

and the `MotionModel`

property to
`'constvel'`

.

`[`

also returns the metrics`posRMSE`

,`velRMSE`

,`accRMSE`

,`posANEES`

,`velANEES`

,`accANEES`

] = errorMetrics(`tracks`

,`trackIDs`

,`truths`

,`truthIDs`

)

`accRMS`

– Acceleration root mean squared error`accANEES`

– acceleration average normalized-estimation error squared

for constant acceleration motion at the current time step.

To enable this syntax, set the `ErrorFunctionFormat`

property to
`'built-in'`

and the `MotionModel`

property to
`'constacc'`

.

`[`

also returns the metrics`posRMSE`

,`velRMSE`

,`yawRateRMSE`

,`posANEES`

,`velANEES`

,`yawRateANEES`

] = errorMetrics(`tracks`

,`trackIDs`

,`truths`

,`truthIDs`

)

`yawRateRMSE`

– yaw rate root mean squared error`yawRateANEES`

– yaw rate average normalized-estimation error squared

for constant turn-rate motion at the current time step.

To enable this syntax, set the `ErrorFunctionFormat`

property to
`'built-in'`

and the `MotionModel`

property to
`'constturn'`

.

`[`

returns the user-defined metrics `out1`

,`out2`

, ... ,`outN`

] = errorMetrics(`tracks`

,`trackIDs`

,`truths`

,`truthIDs`

)`out1`

, `out2`

,
... , `outN`

.

To enable this syntax, set the `ErrorFunctionFormat`

property to
`'custom'`

. The number of outputs corresponds to the number of
elements listed in the `EstimationErrorLabels`

property, and must
match the number of outputs in the `EstimationErrorFcn`

. The results
of the estimation errors are averaged arithmetically over all track-to-truth
assignments.

**Tip**

These usage syntaxes only calculate the RMSE and ANEES values of all tracks with
associated truths at the current time step. To obtain the cumulative RMSE and ANEES values
for each track and truth, use the `cumulativeTrackMetrics`

and `cumulativeTruthMetrics`

object functions, respectively. To obtain the current
RMSE and ANEES values for each track and truth, use the `currentTrackMetrics`

and `currentTruthMetrics`

object functions, respectively.

To use an object function, specify the
System object as the first input argument. For
example, to release system resources of a System object named `obj`

, use
this syntax:

release(obj)