# constvel

Constant velocity state update

## Description

example

updatedstate = constvel(state) returns the updated state, state, of a constant-velocity Kalman filter motion model after a one-second time step.

example

updatedstate = constvel(state,dt) specifies the time step, dt.

updatedstate = constvel(state,w,dt) also specifies state noise, w.

## Examples

collapse all

Update the state of two-dimensional constant-velocity motion for a time interval of one second.

state = [1;1;2;1];
state = constvel(state)
state = 4×1

2
1
3
1

Update the state of two-dimensional constant-velocity motion for a time interval of 1.5 seconds.

state = [1;1;2;1];
state = constvel(state,1.5)
state = 4×1

2.5000
1.0000
3.5000
1.0000

## Input Arguments

collapse all

Kalman filter state for constant-velocity motion, specified as a real-valued 2D-by-N matrix. D is the number of spatial degrees of freedom of motion and N is the number states. The state is expected to be Cartesian state. For each spatial degree of motion, the state vector, as a column of the state matrix, 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 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-by-N matrix. D is the number of spatial degrees of freedom of motion and N is the number of state vectors. For example, D = 2 for the 2-D motion. If specified as a scalar, the scalar value is expanded to a D-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.

## Algorithms

For a two-dimensional constant-velocity process, the state transition matrix after a time step, T, is block diagonal as shown here.

$\left[\begin{array}{c}{x}_{k+1}\\ {v}_{x,k+1}\\ {y}_{k+1}\\ {v}_{y,k+1}\end{array}\right]=\left[\begin{array}{cccc}1& T& 0& 0\\ 0& 1& 0& 0\\ 0& 0& 1& T\\ 0& 0& 0& 1\end{array}\right]\left[\begin{array}{c}{x}_{k}\\ v{x}_{k}\\ {y}_{k}\\ v{y}_{k}\end{array}\right]$

The block for each spatial dimension is:

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

## Version History

Introduced in R2018b