Fuse sensor data for state estimation in
fuses the measurement from a sensor, based on the measurement noise, for state estimation.
stateCovariance] = fuse(
Fuse Gyroscope Data Using
insAccelerometer sensor object and
insGyroscope sensor object.
acc = insAccelerometer; gyro = insGyroscope;
insEKF object using the two sensor objects.
filter = insEKF(acc,gyro);
Fuse a gyroscope measurement of
[0.1 0.2 –0.04] with a measurement noise covariance of
diag([0.2 0.2 0.2]) .
[state,stateCov] = fuse(filter,gyro,[0.1 0.2 -0.04],diag([0.2 0.2 0.2]));
Show the fused state.
state = 13×1 1.0000 0 0 0 0.0455 0.0909 -0.0182 0 0 0 ⋮
sensor — Inertial sensor
insAccelerometer object |
insGyroscope object |
insMagnetometer object |
insGPS object | object inheriting from
positioning.insSensorModel interface class
Inertial sensor, specified as one of these objects used to construct the
insEKF filter object:
An object inheriting from the
measurement — Measurement from sensor
M-element real-valued vector
Measurement from the sensor, specified as an M-element real-valued vector,
where M is the dimension of the measurement from the
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 from the
sensor object. 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
state — State vector after measurement fusion
N-element real-valued vector
State vector after measurement fusion, returned as an N-element real-valued vector, where N is the dimension of the filter state.
stateCovariance — State estimate error covariance after measurement fusion
N-by-N real-valued positive definite
State estimate error covariance after measurement fusion, 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