# residualmag

Residuals and residual covariance from magnetometer measurements for `insfilterAsync`

Since R2020a

## Syntax

``[res,resCov] = residualmag(FUSE,magReadings,magReadingsCovariance)``

## Description

example

````[res,resCov] = residualmag(FUSE,magReadings,magReadingsCovariance)` computes the residual, `residual`, and the residual covariance, `resCov`, based on the magnetometer readings and the corresponding covariance.```

## Examples

collapse all

`Create` an `insfilterAsync` object and display its state.

```filter = insfilterAsync; disp(filter.State')```
``` 1.0000 0 0 0 0 0 0 0 0 0 0 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.

```magReading = [132.7000 91.1000 60.5000]; magCovariance = eye(3);```

Obtain the residual and residual covariance.

`[res,resCovariance] = residualmag(filter,magReading,magCovariance)`
```res = 1×3 105.1450 93.5169 76.5849 ```
```resCovariance = 3×3 5.0974 0 0 0 5.0974 0 0 0 5.0974 ```

## Input Arguments

collapse all

`insfilterAsync`, specified as an object.

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`

## Output Arguments

collapse all

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.

## Version History

Introduced in R2020a