# correct

Correct states using direct state measurements for insfilterErrorState

## Description

example

correct(FUSE,idx,measurement,measurementCovariance) corrects the state and state estimation error covariance of FUSE, an insfilterErrorState object, based on the measurement and measurement covariance. The measurement maps directly to the state specified by the indices idx.

## Examples

collapse all

Create an insfilterErrorState object and display its state.

filter = insfilterErrorState;
disp(filter.State')
1     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     1

Fuse a position measurement with its corresponding covariance.

idx = [5 6 7];
measure = [10 10 0];
measureCov = 1e-4*diag([5 5 5]);
correct(filter,idx,measure,measureCov)

Display the state after the fusing.

disp(filter.State')
0.8724   -0.2822   -0.2822   -0.2822    6.6656    6.6656    6.6656    6.6656    6.6656    6.6656    6.6656    6.6656    6.6656    6.6656    6.6656    6.6656    7.6656

## Input Arguments

collapse all

insfilterErrorState, specified as an object.

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

The state values represent:

StateUnitsIndex
Orientation (quaternion parts)N/A1:4
Position (NED)m5:7
Velocity (NED)m/s8:10
Accelerometer Bias (XYZ)m/s214:16
Visual Odometry Scale (XYZ)N/A17

Data Types: single | double

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

Data Types: single | double

Covariance of measurement, specified as a scalar, M-element vector, or M-by-M matrix. If you correct orientation (state indices 1–4), then M = numel(idx)-1. If you do not correct orientation, then M = numel(idx).

Data Types: single | double

## Version History

Introduced in R2019a