Main Content

ctrv

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

Since R2024b

Description

predictedState = ctrv(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 and velocity magnitude 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

ctrv represents velocity in the xy-plane with velocity magnitude and direction. For the constant turn-rate and velocity-magnitude motion model using Cartesian components, Vx and Vy, see constturn.

example

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

example

predictedState = ctrv(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 1 degree per second.

state = [1;2;2;30;1];

Update the state with a default time step dt = 1 second.

state = ctrv(state)
state = 5×1

    2.7232
    3.0151
    2.0000
   31.0000
    1.0000

Update the state again, this time dt = 0.1 second.

state = ctrv(state,0.1)
state = 5×1

    2.8946
    3.1182
    2.0000
   31.1000
    1.0000

Update the state again, with process noise inputs, and time step dt = 0.1 second.

state = ctrv(state,[0.2;0.5],0.1)
state = 5×1

    3.0666
    3.2222
    2.0200
   31.2025
    1.0500

Define an initial state matrix for 3-D constant turn-rate motion.

states = [1 3 4;-1 2 10;5 3 1.3;1 1.3 2.1;30 0 -30;4.7 3.4 4.5;1.8 2 3];

Update the state with a default time step dt = 1 second.

states = ctrv(states)
states = 7×3

    5.7516    5.9992    5.2528
    0.3625    2.0681    9.7131
    5.0000    3.0000    1.3000
   31.0000    1.3000  -27.9000
   30.0000    0.0000  -30.0000
    6.5000    5.4000    7.5000
    1.8000    2.0000    3.0000

Update the state again, this time dt = 0.1 second.

states = ctrv(states, 0.1*randn(3,3), 0.1)
states = 7×3

    6.1735    6.2996    5.3658
    0.6313    2.0749    9.6494
    5.0054    3.0086    1.2957
   34.0009    1.3002  -30.8998
   30.0183    0.0032  -29.9966
    6.6789    5.5993    7.8018
    1.7774    1.9869    3.0358

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;y;s;theta;omega], where:

    • x and y represent the x-coordinate and y-coordinate in meters.

    • s represents the velocity magnitude in meters/second.

    • theta represents the course direction in the xy-plane, counter-clockwise with respect to the x-axis, in degrees.

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

  • 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;y;s;theta;omega;z;vz], where:

    • x and y represent the x-coordinate and y-coordinate in meters.

    • s represents the velocity magnitude in meters/second.

    • theta represents the course direction in the xy-plane, counter-clockwise with respect to the x-axis, in degrees.

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

    • z represent the position in the vertical plane in meters.

    • vz represents velocity component in the vertical plane in meters/second.

  • When you specify the current state as a 5-by-N or 7-by-N real-valued matrix, each column represents a different state vector, and N represents the number of states.

Example: [0;300;15;40;0.5]

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-by-N matrix. D is the number of motion dimensions and N is the number of state vectors. The components in each columns are [ah;ayaw] for 2-D motion or [ah;ayaw;az] for 3-D motion, where:

  • ah represents the process noise in horizontal plane acceleration, measured in meters/second2;

  • ayaw represents the process noise in yaw acceleration, measured in degrees/second2;

  • az represents the process noise in vertical plane acceleration, measured in meters/second2.

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.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2024b