predict

Predict state and state estimation error covariance of tracking filter

Description

example

[xpred,Ppred] = predict(filter) returns the predicted state, xpred, and the predicted state estimation error covariance, Ppred, for the next time step of the input tracking filter. The predicted values overwrite the internal state and state estimation error covariance of filter.

[xpred,Ppred] = predict(filter,dt) specifies the time step as a positive scalar in seconds, and returns one or more of the outputs from the preceding syntaxes.

[xpred,Ppred] = predict(filter,predparams) specifies additional prediction parameters used by the state transition function. The state transition function is defined in the StateTransitionFcn property of filter.

predict(filter,___) updates filter with the predicted state and state estimation error covariance without returning the predicted values. Specify the tracking filter and any of the input argument combinations from preceding syntaxes.

xpred = predict(filter,___) updates filter with the predicted state and state estimation error covariance but returns only the predicted state, xpred.

Examples

collapse all

Create a two-dimensional trackingEKF object and use name-value pairs to define the StateTransitionJacobianFcn and 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 predict and correct functions to propagate the state. You may call predict and 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

Input Arguments

collapse all

Filter for object tracking, specified as one of these objects:

To use the predict function with a trackingKF linear Kalman filter, see predict (trackingKF).

Time step for next prediction, specified as a positive scalar in seconds.

Prediction parameters used by the state transition function, specified as a comma-separated list of arguments. These arguments are the same arguments that are passed into the state transition function specified by the StateTransitionFcn property of the input filter.

Suppose you set the StateTransitionFcn property to @constacc and then call the predict function:

[xpred,Ppred] = predict(filter,dt)
The predict function internally calls the following:
state = constacc(state,dt)

Output Arguments

collapse all

Predicted state of the filter, specified as a vector or matrix. The State property of the input filter is overwritten with this value.

Predicted state covariance of the filter, specified as a vector or matrix. The StateCovariance property of the input filter is overwritten with this value.

Predicted measurement, specified as a vector or matrix. You can return zpred only when filter is a trackingABF object.

Extended Capabilities

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

Introduced in R2018b