Create a constant velocity tracking particle filter object, trackingPF
, from an initial detection report. The detection report is made from an initial 3-D position measurement of the particle filter state in spherical coordinates. You can obtain the 3-D position measurement using the constant velocity measurement function, cvmeas
.
This example uses the coordinates, az = 30, e1 = 5, r = 100, rr = 4
and a measurement noise of diag([2.5, 2.5, 0.5, 1].^2)
.
Use the MeasurementParameters
property of the detection
object to define the frame. When not defined, the fields of the MeasurementParameters
struct use default values. In this example, sensor position, sensor velocity, orientation, elevation, and range rate flags are default.
detection =
objectDetection with properties:
Time: 0
Measurement: [4×1 double]
MeasurementNoise: [4×4 double]
SensorIndex: 1
ObjectClassID: 0
ObjectClassParameters: []
MeasurementParameters: [1×1 struct]
ObjectAttributes: {}
Use initcvpf
to create a trackingPF
filter initialized at the provided position and using the measurement noise defined above.
pf =
trackingPF with properties:
State: [6⨯1 double]
StateCovariance: [6⨯6 double]
IsStateVariableCircular: [0 0 0 0 0 0]
StateTransitionFcn: @constvel
ProcessNoiseSamplingFcn: []
ProcessNoise: [3×3 double]
HasAdditiveProcessNoise: 0
MeasurementFcn: @cvmeas
MeasurementLikelihoodFcn: []
MeasurementNoise: [4×4 double]
Particles: [6×1000 double]
Weights: [1.0000e-03 1.0000e-03 1.0000e-03 1.0000e-03 1.0000e-03 1.0000e-03 1.0000e-03 1.0000e-03 1.0000e-03 1.0000e-03 1.0000e-03 1.0000e-03 1.0000e-03 1.0000e-03 1.0000e-03 1.0000e-03 1.0000e-03 1.0000e-03 … ] (1×1000 double)
ResamplingPolicy: [1×1 trackingResamplingPolicy]
ResamplingMethod: 'multinomial'
Verify that the filter state produces approximately the same measurement as detection.Measurement
.
meas2 = 4×1
29.9188
5.0976
99.8303
4.0255