Correct state and state estimation error covariance using tracking filter
returns the corrected state,
Pcorr] = correct(
xcorr, and the corrected state
estimation error covariance,
Pcorr, for the next time step of the
input tracking filter based on the current measurement,
corrected values overwrite the internal state and state estimation error covariance of
specifies additional parameters used by the measurement function that is defined in the
Pcorr] = correct(
MeasurementFcn property of
filter. You can
return any of the outputs from preceding syntaxes.
filter with the corrected state and state estimation error
covariance without returning the corrected values. Specify the tracking filter and any of
the input argument combinations from preceding syntaxes.
Create a two-dimensional
trackingEKF object and use name-value pairs to define the
MeasurementJacobianFcn properties. Use the predefined constant-velocity motion and measurement models and their Jacobians.
EKF = trackingEKF(@constvel,@cvmeas,[0;0;0;0], ... 'StateTransitionJacobianFcn',@constveljac, ... 'MeasurementJacobianFcn',@cvmeasjac);
Run the filter. Use the
correct functions to propagate the state. You may call
correct in any order and as many times you want. Specify the measurement in Cartesian coordinates.
measurement = [1;1;0]; [xpred, Ppred] = predict(EKF); [xcorr, Pcorr] = correct(EKF,measurement); [xpred, Ppred] = predict(EKF); [xpred, Ppred] = predict(EKF)
xpred = 4×1 1.2500 0.2500 1.2500 0.2500
Ppred = 4×4 11.7500 4.7500 0 0 4.7500 3.7500 0 0 0 0 11.7500 4.7500 0 0 4.7500 3.7500
zmeas— Measurement of filter
Measurement of the tracked object, specified as a vector or matrix.
measparams— Measurement parameters
Measurement function arguments, specified as a comma-separated list of arguments.
These arguments are the same ones that are passed into the measurement function
specified by the
MeasurementFcn property of the tracking filter.
filter is a
then you cannot specify
Suppose you set
and then call
[xcorr,Pcorr] = correct(filter,frame,sensorpos,sensorvel)
correctfunction internally calls the following:
meas = cameas(state,frame,sensorpos,sensorvel)
zcov— Measurement covariance
Measurement covariance, specified as an M-by-M
matrix, where M is the dimension of the measurement. The same
measurement covariance matrix is assumed for all measurements in
xcorr— Corrected state of filter
Corrected state of the filter, specified as a vector or matrix. The
State property of the input
overwritten with this value.
Pcorr— Corrected state covariance of filter
Corrected state covariance of the filter, specified as a vector or matrix. The
StateCovariance property of the input
is overwritten with this value.