Main Content


Residuals and residual covariances from direct state measurements for ahrs10filter

Since R2020a



[res, resCov]= residual(FUSE,idx,measurement,measurementCovariance) computes the residual, res, and the residual covariance, resCov, based on the direct state measurement and measurement covariance. The measurement maps directly to the states specified by indices, idx.


collapse all

Create an ahrs10filter object and display its state.

filter = ahrs10filter;
    1.0000         0         0         0         0         0         0         0         0         0         0         0   27.5550   -2.4169  -16.0849         0         0         0

Specify a measurement of altitude and vertical velocity.

idx = [5 6];
measure = [500 10];
measureCov = diag([5 1])*16-6;

Obtain the residual for the measurement.

[res,rescov] = residual(filter,idx,measure,measureCov)
res = 1×2

   500    10

rescov = 2×2

   74.0000   -6.0000
   -6.0000   10.0000

Input Arguments

collapse all

ahrs10filter, specified as an object.

State vector index of measurement to correct, specified as an N-element vector of increasing integers in the range [1,18].

The state values represent:

Orientation (quaternion parts)N/A1:4
Altitude (NED)m5
Vertical Velocity (NED)m/s6
Delta Angle Bias (XYZ)rad/s7:9
Delta Velocity Bias (XYZ)m/s10:12
Geomagnetic Field Vector (NED)μT13:15
Magnetometer Bias (XYZ)μT16:18

Direct measurement of state, specified as a N-element vector. N is the number of elements of the index argument, idx.

Covariance of measurement, specified as an N-by-N matrix. N is the number of elements of the index argument, idx.

Output Arguments

collapse all

Measurement residual, returned as a 1-by-N vector of real values.

Residual covariance, returned as a N-by-N matrix of real values.

Extended Capabilities

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

Version History

Introduced in R2020a

See Also