# constturn

State transition function for constant turn-rate and velocity-magnitude motion model

## Syntax

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

## Description

````predictedState = constturn(state)` returns the predicted state, `predictedState`, obtained from the current state, `state`, based on the constant turn-rate and velocity-magnitude motion model. The default time step is 1 second. Constant turn rate mean that motion in the xy-plane follows a constant angular velocity and motion in the vertical z directions follows a constant velocity model. Note`constturn` represents velocity in the xy-plane with its Cartesian components, `Vx` and `Vy`. For the constant turn-rate and velocity-magnitude motion model using velocity magnitude and course direction, see `ctrv`. ```

example

````predictedState = constturn(state,dt)` also specifies the time step, `dt`.```

example

````predictedState = 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

Current state for constant turn-rate motion, specified as a real-valued vector or matrix.

• When you specify the current state as a five-element vector, the state vector describes 2-D motion in the xy-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` and `y` represent the x-coordinate and y-coordinate in meters.

• `vx` and `vy` represent the velocity in the x and y direction in meters/second.

• `omega` represents the turn-rate in degrees/second.

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

• When you specify the current state as a seven-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`, `y`, and `z` represent the x-, y-, and `z`-coordinate in meters.

• `vx`, `vy`, and `vz` represent the velocity in the x, y, and z direction in meters/second.

• `omega` represents the turn-rate in degrees/second.

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

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

Data Types: `single` | `double`

Time step interval, 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

Predicted state, 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 R2018b