# constveljac

Jacobian of state transition function based on constant-velocity motion model

Since R2021a

## Syntax

``Jx = constveljac(state)``
``Jx = constveljac(state,dt) ``
``[Jx,Jw] = constveljac(state,w,dt)``

## Description

````Jx = constveljac(state)` returns the Jacobian of the state transition function based on the constant-velocity motion model. The default time step is 1 second. By default, `constveljac` returns the Jacobian `Jx` with respect to the input state, `state`.```

example

````Jx = constveljac(state,dt) ` specifies the time step, `dt`.```

example

````[Jx,Jw] = constveljac(state,w,dt)` specifies the state noise, `w`, and returns the Jacobian, `Jw`, of the state with respect to the noise. ```

## Examples

collapse all

Compute the state Jacobian for a two-dimensional constant-velocity motion model for a one second update time.

```state = [1,1,2,1].'; jacobian = constveljac(state)```
```jacobian = 4×4 1 1 0 0 0 1 0 0 0 0 1 1 0 0 0 1 ```

Compute the state Jacobian for a two-dimensional constant-velocity motion model for a half-second update time.

`state = [1;1;2;1];`

Compute the state update Jacobian for 0.5 second.

`jacobian = constveljac(state,0.5)`
```jacobian = 4×4 1.0000 0.5000 0 0 0 1.0000 0 0 0 0 1.0000 0.5000 0 0 0 1.0000 ```

## Input Arguments

collapse all

State vector for constant-velocity motion, specified as a real-valued 2N-element column vector where N is the number of spatial degrees of freedom of motion. The `state` is expected to be Cartesian state. For each spatial degree of motion, the state vector takes the form shown in this table.

Spatial DimensionsState Vector Structure
1-D`[x;vx]`
2-D`[x;vx;y;vy]`
3-D`[x;vx;y;vy;z;vz]`

For example, `x` represents the x-coordinate and `vx` represents the velocity in the x-direction. If the motion model is 1-D, values along the y and z axes are assumed to be zero. If the motion model is 2-D, values along the z axis are assumed to be zero. Position coordinates are in meters and velocity coordinates are in meters/sec.

Example: `[5;.1;0;-.2;-3;.05]`

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 real valued N-by-1 vector. N is the number of motion dimensions. For example, N = 2 for the 2-D motion. If specified as a scalar, the scalar value is expanded to an N-by-1 vector.

Data Types: `single` | `double`

## Output Arguments

collapse all

Jacobian of the state transition function with respect to the input state, returned as a real-valued 2N-by-2N matrix. N is the number of spatial degrees of motion. The function constructs the Jacobian from the partial derivatives of the state at the updated time step with respect to the state at the input time step.

Jacobian of the state transition function with respect to the noise, returned as a real-valued 2N-by-N matrix. N is the number of spatial degrees of motion. The function constructs the Jacobian from the partial derivatives of the state at the updated time step with respect to the noise components.

## Algorithms

For a two-dimensional constant-velocity motion, the Jacobian matrix for a time step, T, is block diagonal:

`$\left[\begin{array}{cccc}1& T& 0& 0\\ 0& 1& 0& 0\\ 0& 0& 1& T\\ 0& 0& 0& 1\end{array}\right]$`

The block for each spatial dimension has this form:

`$\left[\begin{array}{cc}1& T\\ 0& 1\end{array}\right]$`

## Version History

Introduced in R2021a