Main Content

correct

Correct state estimates in insEKF using direct state measurements

Since R2022a

Description

[state,stateCovariance] = correct(filter,indices,measurement,measurementNoise) corrects filter estimates based on a measurement, the associated index of the measurement, and the measurement noise. The measurement must be a direct measurement of the state vector. For fusing indirect measurements, use the fuse object function.

example

Examples

collapse all

Create a default insEKF object and show its state.

filter = insEKF;
filter.State
ans = 13×1

     1
     0
     0
     0
     0
     0
     0
     0
     0
     0
      ⋮

Obtain the indices corresponding to the angular velocity state.

idx = stateinfo(filter,"AngularVelocity");

Correct the angular velocity state and show the corrected state.

state = correct(filter,idx,[1 1 1], diag([0.1 0.1 0.1]))
state = 13×1

    1.0000
         0
         0
         0
    0.9091
    0.9091
    0.9091
         0
         0
         0
      ⋮

Input Arguments

collapse all

INS filter, specified as an insEKF object.

State indices of the measurement, specified as an M-element vector of state indices, where M is the dimension of the measurement. For example, if the measurement is the first and third elements in the state vector of the filter, then specify indices as [1 3].

Direct state measurement, specified as an M-element real-valued vector, where M is the dimension of the measurement.

Data Types: single | double

Measurement noise, specified as an M-by-M real-valued positive-definite matrix, an M-element vector of positive values, or a positive scalar. M is the dimension of the measurement. When specified as a vector, the vector expands to the diagonal of an M-by-M diagonal matrix. When specified as a scalar, the value of the property is the product of the scalar and an M-by-M identity matrix.

Data Types: single | double

Output Arguments

collapse all

Corrected state vector, returned as an N-element real-valued vector, where N is the dimension of the filter state.

Data Types: single | double

Corrected state estimate error covariance, returned as an N-by-N real-valued positive definite matrix, where N is the dimension of the state.

Data Types: single | double

Extended Capabilities

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

Version History

Introduced in R2022a