getTrackVelocities
Obtain updated track velocities and velocity covariance matrix
Syntax
Description
returns a matrix of track velocities based on tracks and the velocity
selector.velocities
= getTrackVelocities(tracks
,velocitySelector
)
[
also returns the track velocity covariance matrices.velocities
,velocityCovariances
]
= getTrackVelocities(tracks
,velocitySelector
)
Examples
Input Arguments
tracks
— Object tracks
array of objectTrack
objects  array of structures
Object tracks, specified as an array of objectTrack
objects or an
array of structures containing sufficient information to obtain the track
velocity information. At a minimum, these structures must contain a
State
column vector field and a positivedefinite
StateCovariance
matrix field. For a sample
track structure, see toStruct
.
Note
If you specify tracks
as an empty objectTrack
object, an
empty cell, or an empty track structure,
velocities
and
velocityCovariances
are returned based on
the second argument (velocitySelector
or
modelName
) as follows.
Second input argument  velocities  velocityCovariances 

velocitySelector 


modelName 


modelName
— Motion model name
"constvel"
 "constacc"
 "singer"
 "constturn"
 "ctrv"
Motion model name, specified as one of these options:
"constvel"
— The function obtains the velocity states based on the state definition in theconstvel
function."constacc"
— The function obtains the velocity states based on the state definition in theconstacc
function."constturn"
— The function obtains the velocity states based on the state definition in theconstturn
function.In R2024b:
"ctrv"
— The function obtains the velocity states based on the state definition in thectrv
function."singer"
— The function obtains the velocity states based on the state definition in thesinger
function. The use ofsinger
model requires the Sensor Fusion and Tracking Toolbox™.
velocitySelector
— Velocity selection matrix
DbyN realvalued matrix.
Velocity selector, specified as a DbyN realvalued matrix of ones and zeros. D is the number of dimensions of the tracker. N is the size of the state vector. Using this matrix, the function extracts track velocities from the state vector. Multiply the state vector by velocity selector matrix returns velocities. The same selector is applied to all object tracks.
Output Arguments
velocities
— Velocities of tracked objects
realvalued 1byD vector  realvalued MbyD matrix
Velocities of tracked objects at last update time, returned as a 1byD vector or a realvalued MbyD matrix. D represents the number of velocity elements. M represents the number of tracks.
velocityCovariances
— Velocity covariance matrices of tracked objects
realvalued DbyDmatrix  realvalued
DbyDbyM
array
Velocity covariance matrices of tracked objects, returned as a realvalued DbyDmatrix or a realvalued DbyDbyM array. D represents the number of velocity elements. M represents the number of tracks. Each DbyD submatrix is a velocity covariance matrix for a track.
More About
Velocity Selector for 2Dimensional Motion
Show the velocity selection matrix for twodimensional motion when the state consists of the position and velocity.
$$\left[\begin{array}{cccc}0& 1& 0& 0\\ 0& 0& 0& 1\end{array}\right]$$
Velocity Selector for 3Dimensional Motion
Show the velocity selection matrix for threedimensional motion when the state consists of the position and velocity.
$$\left[\begin{array}{cccccc}0& 1& 0& 0& 0& 0\\ 0& 0& 0& 1& 0& 0\\ 0& 0& 0& 0& 0& 1\end{array}\right]$$
Velocity Selector for 3Dimensional Motion with Acceleration
Show the velocity selection matrix for threedimensional motion when the state consists of the position, velocity, and acceleration.
$$\left[\begin{array}{ccccccccc}0& 1& 0& 0& 0& 0& 0& 0& 0\\ 0& 0& 0& 0& 1& 0& 0& 0& 0\\ 0& 0& 0& 0& 0& 0& 0& 1& 0\end{array}\right]$$
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
In code generation, if you use the
modelName
input, thetracks
input must be specified as nonempty structures. Use the following if empty structures are unavoidable:if isempty(tracks) % Return the sizes and data types you desire velocities = zeros(0,3,"single"); velocitiesCovariances = zeros(3,3,0,"single"); else [velocities,velocityCovariances] = getTrackVelocities(tracks,"constvel"); end
Version History
Introduced in R2018bR2022b: Obtain velocity and covariance from tracks using motion model name input
You can now obtain velocities and associated covariances of tracks by specifying the motion model name as an input. For example,
[positions,covariances] = getTrackVelocities(tracks,"constvel")
constvel
function.See Also
Functions
Objects
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
 América Latina (Español)
 Canada (English)
 United States (English)
Europe
 Belgium (English)
 Denmark (English)
 Deutschland (Deutsch)
 España (Español)
 Finland (English)
 France (Français)
 Ireland (English)
 Italia (Italiano)
 Luxembourg (English)
 Netherlands (English)
 Norway (English)
 Österreich (Deutsch)
 Portugal (English)
 Sweden (English)
 Switzerland
 United Kingdom (English)