Correct state estimates in
insEKF using direct state
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
stateCovariance] = correct(
fuse object function.
Correct Angular Velocity State in insEKF
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 ⋮
indices — State indices
M-element vector of state indices
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
measurement — Direct state measurement
M-element real-valued vector
Direct state measurement, specified as an M-element real-valued vector, where M is the dimension of the measurement.
measurementNoise — Measurement noise
M-by-M real-valued positive-definite
matrix | M-element vector of positive values | positive scalar
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.
state — Corrected state vector
N-element real-valued vector
Corrected state vector, returned as an N-element real-valued vector, where N is the dimension of the filter state.
stateCovariance — Corrected state estimate error covariance
N-by-N real-valued positive definite
Corrected state estimate error covariance, returned as an N-by-N real-valued positive definite matrix, where N is the dimension of the state.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Introduced in R2022a