# constturn

Constant turn-rate motion model

## Syntax

``updatedstate = constturn(state)``
``updatedstate = constturn(state,dt)``
``updatedstate = constturn(state,w,dt)``

## Description

example

````updatedstate = constturn(state)` returns the updated state, `updatedstate`, obtained from the previous state, `state`, after a one-second step time for motion modelled as constant turn rate. Constant turn rate means that motion in the x-y plane follows a constant angular velocity and motion in the vertical z directions follows a constant velocity model.```

example

````updatedstate = constturn(state,dt)` also specifies the time step, `dt`.```
````updatedstate = constturn(state,w,dt)` also specifies noise, `w`.```

## Examples

collapse all

Define an initial state for 2-D constant turn-rate motion. The turn rate is 12 degrees per second. Update the state to one second later.

```state = [500,0,0,100,12].'; state = constturn(state)```
```state = 5×1 489.5662 -20.7912 99.2705 97.8148 12.0000 ```

Define an initial state for 2-D constant turn-rate motion. The turn rate is 12 degrees per second. Update the state to 0.1 seconds later.

```state = [500,0,0,100,12].'; state = constturn(state,0.1)```
```state = 5×1 499.8953 -2.0942 9.9993 99.9781 12.0000 ```

## Input Arguments

collapse all

State vector for a constant turn-rate motion model in two or three spatial dimensions, specified as a real-valued vector or matrix.

• When specified as a 5-element vector, the state vector describes 2-D motion in the x-y plane. You can specify the state vector as a row or column vector. The components of the state vector are `[x;vx;y;vy;omega]` where `x` represents the x-coordinate and `vx` represents the velocity in the x-direction. `y` represents the y-coordinate and `vy` represents the velocity in the y-direction. `omega` represents the turn rate.

When specified as a 5-by-N matrix, each column represents a different state vector N represents the number of states.

• When specified as a 7-element vector, the state vector describes 3-D motion. You can specify the state vector as a row or column vector. The components of the state vector are `[x;vx;y;vy;omega;z;vz]` where `x` represents the x-coordinate and `vx` represents the velocity in the x-direction. `y` represents the y-coordinate and `vy` represents the velocity in the y-direction. `omega` represents the turn rate. `z` represents the z-coordinate and `vz` represents the velocity in the z-direction.

When specified as a 7-by-N matrix, each column represents a different state vector. N represents the number of states.

Position coordinates are in meters. Velocity coordinates are in meters/second. Turn rate is in degrees/second.

Example: `[5;0.1;4;-0.2;0.01]`

Data Types: `double`

Time step interval of filter, specified as a positive scalar. Time units are in seconds.

Example: `0.5`

Data Types: `single` | `double`

State noise, specified as a scalar or real-valued (D+1)-length -by-N matrix. D is the number of motion dimensions and N is the number of state vectors. The components are each columns are `[ax;ay;alpha]` for 2-D motion or `[ax;ay;alpha;az]` for 3-D motion. `ax`, `ay`, and `az` are the linear acceleration noise values in the x-, y-, and z-axes, respectively, and `alpha` is the angular acceleration noise value. If specified as a scalar, the value expands to a (D+1)-by-N matrix.

Data Types: `single` | `double`

## Output Arguments

collapse all

Updated state vector, returned as a real-valued vector or real-valued matrix with same number of elements and dimensions as the input state vector.

## Version History

Introduced in R2017a