Main Content

# fuse

Fuse sensor data for state estimation in `insEKF`

Since R2022a

## Syntax

``[state,stateCovariance] = fuse(filter,sensor,measurement,measurementNoise)``

## Description

example

````[state,stateCovariance] = fuse(filter,sensor,measurement,measurementNoise)` fuses the measurement from a sensor, based on the measurement noise, for state estimation. ```

## Examples

collapse all

Create an `insAccelerometer` sensor object and `insGyroscope` sensor object.

```acc = insAccelerometer; gyro = insGyroscope;```

Construct an `insEKF` object using the two sensor objects.

`filter = insEKF(acc,gyro);`

Fuse a gyroscope measurement of `[0.1 0.2 –0.04]` $\mathrm{rad}/\mathit{s}$ with a measurement noise covariance of `diag([0.2 0.2 0.2])` ${\left(\mathrm{deg}/\mathit{s}\right)}^{2}$.

`[state,stateCov] = fuse(filter,gyro,[0.1 0.2 -0.04],diag([0.2 0.2 0.2]));`

Show the fused state.

`state`
```state = 13×1 1.0000 0 0 0 0.0455 0.0909 -0.0182 0 0 0 ⋮ ```

## Input Arguments

collapse all

INS filter, specified as an `insEKF` object.

Inertial sensor, specified as one of these objects used to construct the `insEKF` filter object:

Measurement from the sensor, specified as an M-element real-valued vector, where M is the dimension of the measurement from the `sensor` object.

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 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 matrix.

Data Types: `single` | `double`

## Output Arguments

collapse all

State vector after measurement fusion, returned as an N-element real-valued vector, where N is the dimension of the filter state.

Data Types: `single` | `double`

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.

Data Types: `single` | `double`

## Version History

Introduced in R2022a