Main Content

ctrect

Constant turn-rate rectangular target motion model

Since R2019b

Description

updatedstates = ctrect(states) returns the updated rectangular states from the current rectangular states based on the rectangular target motion model. The default time step is 1 second.

updatedstates = ctrect(states,dt) specifies the time step, dt, in seconds.

example

updatedstates = ctrect(states,w,dt) additionally specifies the process noise, w.

Examples

collapse all

Define a rectangular state.

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

Predict the state dt = 1 second forward using the default syntax.

state = ctrect(state,0.1)
state = 1×7

    1.1731    2.1002    2.0000   30.1000    1.0000    4.7000    1.8000

Predict the state dt = 0.1 second forward without noise.

state = ctrect(state,0.1)
state = 1×7

    1.3461    2.2006    2.0000   30.2000    1.0000    4.7000    1.8000

Predict the state dt = 0.1 second forward with noise.

state = ctrect(state,0.01,0.1)
state = 1×7

    1.5189    2.3014    2.0010   30.3000    1.0010    4.7000    1.8000

Define a state matrix.

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];

Predict the state dt = 1 second ahead.

states = ctrect(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
    4.7000    3.4000    4.5000
    1.8000    2.0000    3.0000

Predict the state dt = 0.1 second ahead without noise.

states = ctrect(states,0.1)
states = 7×3

    6.1732    6.2992    5.3660
    0.6311    2.0749    9.6493
    5.0000    3.0000    1.3000
   34.0000    1.3000  -30.9000
   30.0000    0.0000  -30.0000
    4.7000    3.4000    4.5000
    1.8000    2.0000    3.0000

Predict the state dt = 0.1 second ahead with noise.

states = ctrect(states,0.1*randn(2,3),0.1)
states = 7×3

    6.5805    6.5979    5.4759
    0.9216    2.0816    9.5795
    5.0054    2.9774    1.3032
   37.0009    1.3004  -33.9007
   30.0183    0.0086  -30.0131
    4.7000    3.4000    4.5000
    1.8000    2.0000    3.0000

Input Arguments

collapse all

Current rectangular states, specified as a 1-by-7 real-valued vector, 7-by-1 real-valued vector, or a 7-by-N real-valued matrix, where N is the number of states. The seven dimensional rectangular target state is defined as [x; y; s; θ; ω; L; W]:

VariableMeaning Unit
x

Position of the rectangle center in x direction

m
y

Position of the rectangle center in y direction

m
s

Speed in the heading direction

m/s
θ

Orientation angle of the rectangle with respect to x direction

degree
ω

Turn-rate

degree/s
L

Length of the rectangle

m
W

Width of the rectangle

m

Rectangular Target State

Example: [1;2;2;30;1;4.7;1.8]

Data Types: single | double

Time step, specified as a real-valued positive scalar in second.

Data Types: single | double

Process noise, specified as a 2-by-N real-valued matrix, where N is the number of states specified in the states input. If specified as a scalar, it is expanded to a 2-by-N matrix with all elements equal to the scalar. The first row of the matrix specifies the process noise in acceleration (m/s2). The second row specifies the process noise in yaw acceleration (degrees/s2).

Data Types: single | double

Output Arguments

collapse all

Updated states, specified as a 1-by-7 real-valued vector, a 7-by-1 real-valued vector, or a 7-by-N real-valued matrix, where N is the number of states. The dimensions and setups of updatedstates output are exactly the same as those of the states input.

Data Types: single | double

Extended Capabilities

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

Version History

Introduced in R2019b