Main Content

fusemag

Correct states using magnetometer data for ahrs10filter

Description

example

[res,resCov] = fusemag(FUSE,magReadings,magReadingsCovariance) fuses magnetometer data to correct the state estimate.

Examples

collapse all

Create an ahrs10filter object and display its state.

filter = ahrs10filter;
disp(filter.State')
    1.0000         0         0         0         0         0         0         0         0         0         0         0   27.5550   -2.4169  -16.0849         0         0         0

Define a magnetometer reading and its covariance. Fuse the magnetometer reading.

magReading = [132.7000   91.1000   60.5000];
magCovariance = 0.1*eye(3);
[res,resCovariance] = fusemag(filter,magReading,magCovariance)
res = 1×3

  105.1450   93.5169   76.5849

resCovariance = 3×3

    0.1041    0.0000   -0.0000
   -0.0000    0.1041    0.0000
    0.0000   -0.0000    0.1041

Display the filter state.

disp(filter.State')
    0.9958   -0.0246    0.0708   -0.0527         0         0         0         0         0         0         0         0   27.5560   -2.4160  -16.0842    0.0010    0.0009    0.0007

Input Arguments

collapse all

Object of ahrs10filter.

Magnetometer readings in µT, specified as a 3-element row vector of finite real numbers.

Data Types: single | double

Magnetometer readings error covariance in µT2, specified as a scalar, 3-element row vector, or 3-by-3 matrix.

Data Types: single | double

Residual, returned as a 1-by-3 vector of real values in µT.

Data Types: single | double

Residual covariance, returned a 3-by-3 matrix of real values in (µT)2.

Extended Capabilities

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

Version History

Introduced in R2019a