Main Content

residual

Measurement residual and residual noise from tracking filter

Description

[zres,rescov] = residual(filter,zmeas) computes the residual and residual covariance of the current given measurement, zmeas, with the predicted measurement in the tracking filter, filter. This function applies to filters that assume a Gaussian distribution for noise.

[zres,rescov] = residual(filter,zmeas,measparams) specifies additional parameters that are used by the MeasurementFcn of the filter.

If filter is a trackingKF object, then you cannot use this syntax.

Input Arguments

collapse all

Filter for object tracking, specified as one of these objects:

Current measurement of a tracked object, specified as a vector or matrix.

Parameters for measurement function, specified as a cell array. The parameters are passed to the measurement function that is defined in the MeasurementFcn property of the input filter. If filter is a trackingKF object, then you cannot specify measparams.

Output Arguments

collapse all

Residual between current and predicted measurement, returned as a matrix.

Residual covariance, returned as a matrix.

Algorithms

collapse all

The residual is the difference between a measurement and the value predicted by the filter. For Kalman filters, the residual calculation depends on whether the filter is linear or nonlinear.

Linear Kalman Filters

Given a linear Kalman filter with a current measurement of z, the residual zres is defined as

zres = zHx,

where:

  • H is the measurement model set by the MeasurementModel property of the filter.

  • x is the current filter state.

The covariance of the residual, S, is defined as

S = R + HPHT,

where:

  • P is the state covariance matrix.

  • R is the measurement noise matrix set by the MeasurementNoise property of the filter.

Nonlinear Kalman Filters

Given a nonlinear Kalman filter with a current measurement of z, the residual zres is defined as:

zres = zh(x),

where:

  • h is the measurement function set by the MeasurementFcn property.

  • x is the current filter state.

The covariance of the residual, S, is defined as:

S = R + Rp,

where:

  • R is the measurement noise matrix set by the MeasurementNoise property of the filter.

  • Rp is the state covariance matrix projected onto the measurement space.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced in R2018a