# constturnjac

Jacobian for constant turn-rate motion

## Syntax

``jacobian = constturnjac(state)``
``jacobian = constturnjac(state,dt) ``
``[jacobian,noisejacobian] = constturnjac(state,w,dt)``

## Description

example

````jacobian = constturnjac(state)` returns the updated Jacobian, `jacobian`, for constant turn-rate Kalman filter motion model for a one-second step time. The `state` argument specifies the current state of the filter. 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

````jacobian = constturnjac(state,dt) ` specifies the time step, `dt`.```
````[jacobian,noisejacobian] = constturnjac(state,w,dt)` also specifies noise, `w`, and returns the Jacobian, `noisejacobian`, of the state with respect to the noise.```

## Examples

collapse all

Compute the Jacobian for a constant turn-rate motion state. Assume the turn rate is 12 degrees/second. The time step is one second.

```state = [500,0,0,100,12]; jacobian = constturnjac(state)```
```jacobian = 5×5 1.0000 0.9927 0 -0.1043 -0.8631 0 0.9781 0 -0.2079 -1.7072 0 0.1043 1.0000 0.9927 -0.1213 0 0.2079 0 0.9781 -0.3629 0 0 0 0 1.0000 ```

Compute the Jacobian for a constant turn-rate motion state. Assume the turn rate is 12 degrees/second. The time step is 0.1 second.

```state = [500,0,0,100,12]; jacobian = constturnjac(state,0.1)```
```jacobian = 5×5 1.0000 0.1000 0 -0.0010 -0.0087 0 0.9998 0 -0.0209 -0.1745 0 0.0010 1.0000 0.1000 -0.0001 0 0.0209 0 0.9998 -0.0037 0 0 0 0 1.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.

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

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 M-by-(D+1)-length vector. D is the number of motion dimensions. D is two for 2-D motion and D is three for 3-D motion. The vector components 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) vector.

Data Types: `single` | `double`

## Output Arguments

collapse all

Constant turn-rate motion Jacobian, returned as a real-valued 5-by-5 matrix or 7-by-7 matrix depending on the size of the `state` vector. The Jacobian is constructed from the partial derivatives of the state at the updated time step with respect to the state at the previous time step.

Constant turn-rate motion noise Jacobian, returned as a real-valued 5-by-(D+1) matrix where D is two for 2-D motion or a real-valued 7-by-(D+1) matrix where D is three for 3-D motion. The Jacobian is constructed from the partial derivatives of the state at the updated time step with respect to the noise components.

## Extended Capabilities

### C/C++ Code GenerationGenerate C and C++ code using MATLAB® Coder™.

Introduced in R2018b