# fusegps

Correct states using GPS data for `insfilterErrorState`

Since R2019a

## Syntax

``[res,resCov] = fusegps(FUSE,position,positionCovariance)``
``[res,resCov] = fusegps(FUSE,position,positionCovariance,velocity,velocityCovariance)``

## Description

example

````[res,resCov] = fusegps(FUSE,position,positionCovariance)` fuses GPS position data to correct the state estimate.```
````[res,resCov] = fusegps(FUSE,position,positionCovariance,velocity,velocityCovariance)` fuses GPS position and velocity data to correct the state estimate.```

## Examples

collapse all

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

```filter = insfilterErrorState; disp(filter.State')```
``` 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 ```

Fuse a GPS position measurement with its covariance.

`position = [5 3 2] % in deg deg meters;`
```position = 1×3 5 3 2 ```
```positionCovariance = diag([1 1 1]); [res,resCovariance] = fusegps(filter,position,positionCovariance)```
```res = 1×3 105 × 5.5218 3.3254 0.3282 ```
```resCovariance = 3×3 2 1 1 1 2 1 1 1 2 ```

Display the state after the fusing.

`disp(filter.State')`
``` 1.0e+05 * 0.0000 -0.0000 -0.0000 -0.0000 2.2939 2.2939 2.2939 2.2939 2.2939 2.2939 2.2939 2.2939 2.2939 2.2939 2.2939 2.2939 2.2939 ```

## Input Arguments

collapse all

`insfilterErrorState`, specified as an object.

Position of GPS receiver in geodetic latitude, longitude, and altitude (LLA) specified as a real finite 3-element row vector. Latitude and longitude are in degrees with north and east being positive. Altitude is in meters.

Data Types: `single` | `double`

Position measurement covariance of GPS receiver in m2, specified as a 3-by-3 matrix.

Data Types: `single` | `double`

Velocity of the GPS receiver in the local NED coordinate system in m/s, specified as a 3-element row vector.

Data Types: `single` | `double`

Velocity measurement covariance of the GPS receiver in the local NED coordinate system in (m/s)2, specified as a 3-by-3 matrix.

Data Types: `single` | `double`

## Output Arguments

collapse all

Position and velocity residual, returned as a 1-by-6 vector of real values in m and m/s, respectively.

Innovation residual, returned as a 6-by-6 matrix of real values.

## Version History

Introduced in R2019a