Main Content

initcvkf

Create constant-velocity linear Kalman filter from detection report

Since R2021a

Description

filter = initcvkf(detection) creates and initializes a constant-velocity linear Kalman filter from information contained in a detection report. For more details, see Algorithms and trackingKF.

example

Examples

collapse all

Create and initialize a 2-D linear Kalman filter object from an initial detection report.

Create the detection report from an initial 2-D measurement, (10,20), of the object position.

detection = objectDetection(0,[10;20],'MeasurementNoise',[1 0.2; 0.2 2], ...
    'SensorIndex',1,'ObjectClassID',1,'ObjectAttributes',{'Yellow Car',5});

Create the new track from the detection report.

filter = initcvkf(detection)
filter = 
  trackingKF with properties:

               State: [4x1 double]
     StateCovariance: [4x4 double]

         MotionModel: '2D Constant Velocity'
        ProcessNoise: [2x2 double]

    MeasurementModel: [2x4 double]
    MeasurementNoise: [2x2 double]

     MaxNumOOSMSteps: 0

     EnableSmoothing: 0

Show the state.

filter.State
ans = 4×1

    10
     0
    20
     0

Show the state transition model.

filter.StateTransitionModel
ans = 4×4

     1     1     0     0
     0     1     0     0
     0     0     1     1
     0     0     0     1

Create and initialize a 3-D linear Kalman filter object from an initial detection report.

Create the detection report from an initial 3-D measurement, (10,20,−5), of the object position.

detection = objectDetection(0,[10;20;-5],'MeasurementNoise',eye(3), ...
    'SensorIndex', 1,'ObjectClassID',1,'ObjectAttributes',{'Green Car', 5});

Create the new filter from the detection report and display its properties.

filter = initcvkf(detection)
filter = 
  trackingKF with properties:

               State: [6x1 double]
     StateCovariance: [6x6 double]

         MotionModel: '3D Constant Velocity'
        ProcessNoise: [3x3 double]

    MeasurementModel: [3x6 double]
    MeasurementNoise: [3x3 double]

     MaxNumOOSMSteps: 0

     EnableSmoothing: 0

Show the state.

filter.State
ans = 6×1

    10
     0
    20
     0
    -5
     0

Show the state transition model.

filter.StateTransitionModel
ans = 6×6

     1     1     0     0     0     0
     0     1     0     0     0     0
     0     0     1     1     0     0
     0     0     0     1     0     0
     0     0     0     0     1     1
     0     0     0     0     0     1

Input Arguments

collapse all

Detection report, specified as an objectDetection object.

Example: detection = objectDetection(0,[1;4.5;3],'MeasurementNoise', [1.0 0 0; 0 2.0 0; 0 0 1.5])

Output Arguments

collapse all

Linear Kalman filter, returned as a trackingKF object.

Algorithms

  • The detection input must contain a 1-D, 2-D, or 3-D position measurement in Cartesian coordinates.

    • For a 1-D position measurement, the function initializes a trackingKF with a 1-D constant velocity model, in which the state is [x; vx]. The function sets the MotionModel property of the filter as "1D Constant Velocity".

    • For a 2-D position measurement, the function initializes a trackingKF with a 2-D constant velocity model, in which the state is [x; vx; y; vy]. The function sets the MotionModel property of the filter as "2D Constant Velocity".

    • For a 3-D position measurement, the function initializes a trackingKF with a 3-D constant velocity model, in which the state is [x; vx; y; vy;z; vz]. The function sets the MotionModel property of the filter as "3D Constant Velocity".

    where x, y, z are the position coordinates. The function sets these position sates same as those in the measurement of the detection. vx, vy, vz are the corresponding velocity states and the function sets these velocity states as 0.

  • The position components of the state error covariance matrix in the initialized trackingKF object are the same as those in the measurement covariance matrix contained in the detection. The velocity components of the state error covariance matrix are set to 100 m2/s2. The cross components of the state error covariance matrix are set to 0.

  • The function computes the process noise matrix assuming a one-second time step and an acceleration standard deviation of 1 m/s2.

  • The measurement noise matrix in the initialized filter is the same as that in the detection.

  • You can use this function as the FilterInitializationFcn property of a radarTracker object.

Extended Capabilities

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

Version History

Introduced in R2021a