# stateparts

Get and set part of state vector in insEKF

## Description

example

part = stateparts(filter,stateName) returns the components of the state vector corresponding to the specified state name of the filter.

example

part = stateparts(filter,sensor,stateName) returns the components of the state vector corresponding to the specified state name of the specified sensor.

example

stateparts(filter,stateName,value) sets the components of the state vector corresponding to the specified state name of the filter to the specified value.

example

stateparts(filter,sensor,stateName,value) sets the components of the state vector corresponding to the specified state name of the specified sensor to the specified value.

## 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);

Set the bias of the accelerometer to [10 0 1] $\mathrm{m}/{\mathrm{s}}^{2}$.

stateparts(filter,acc,"Bias",[10 0 1])

Get the bias of the accelerometer via the sensor.

accBias = stateparts(filter,acc,"Bias")
accBias = 1×3

10     0     1

Get the bias of the accelerometer via the filter.

accBias2 = stateparts(filter,"Accelerometer_Bias")
accBias2 = 1×3

10     0     1

Set the bias of the accelerometer back to [0 0 0].

stateparts(filter,"Accelerometer_Bias",[0 0 0])

## Input Arguments

collapse all

INS filter, specified as an insEKF object.

Name of a part of the state for the filter or the sensor, specified as a string scalar or character vector.

Use the stateinfo object function to find the names of state parts in the filter.

Example: "AngularVelocity"

Example: "Bias"

Data Types: char | string

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

Value for the filter state or sensor state part, specified as an N-element real-valued vector, where N is the number of elements in the state part.

Example: [.2 .3]

Data Types: single | double

## Output Arguments

collapse all

Part of the state vector, returned as a real-valued vector, where N is the number of elements in the state part.

## Version History

Introduced in R2022a