Main Content


Interacting multiple model (IMM) filter for object tracking


The trackingIMM object represents an interacting multiple model (IMM) filter designed for tracking objects that are highly maneuverable. Use the filter to predict the future location of an object, to reduce noise in the detected location, or help associate multiple object detections with their tracks.

The IMM filter deals with the multiple motion models in the Bayesian framework. This method resolves the target motion uncertainty by using multiple models at a time for a maneuvering target. The IMM algorithm processes all the models simultaneously and switches between models according to their updated weights.



imm = trackingIMM returns an IMM filter object with default tracking filters {trackingEKF,trackingEKF,trackingEKF} with the motion models set as constant velocity, constant acceleration, and constant turn, respectively. The filter uses the default conversion function, @switchimm.

imm = trackingIMM(trackingFilters) specifies the TrackingFilters property and sets all other properties to default values.

imm = trackingIMM(trackingFilters,modelConversionFcn) also specifies the ModelConversionFcn property.

imm = trackingIMM(trackingFilters,modelConversionFcn,transitionProbabilities) also specifies the TransitionProbabilities property.


imm = trackingIMM(___,Name,Value) specifies the properties of the filter using one or more Name,Value pair arguments. Any unspecified properties take default values. Specify any other input arguments from previous syntaxes first.


expand all

Filter state, specified as a real-valued M-element vector. Specify the initial state when creating the object using name-value pairs.

Data Types: single | double

State error covariance, specified as an M-by-M matrix, where M is the size of the filter state. A scalar input is extended to an M-by-M matrix. The covariance matrix represents the uncertainty in the filter state. Specify the initial state covariance when creating the object using name-value pairs.

Example: eye(6)

Data Types: single | double

List of filters, specified as a cell array of tracking filters. By default, the filters have equal probability. Specify ModelProbabilities if the filters have different probabilities.

Data Types: cell

Function to convert the state or state covariance, specified as a function handle. The function converts the state or state covariance from one model type to another. The function signature is:

function x2 = modelConversionFcn(modelType1,x1,modelType2)

The modelType1 and modelType2 inputs are the names of the two model names. x1 specifies the State or StateCovariance of the first model. x2 outputs the State or StateCovariance

Data Types: function_handle

Probability of filter model transitions, specified as a positive real scalar, L-element vector, or L-by-L matrix, where L is the number of filters:

  • When specified as a scalar, the probability is uniform for staying on each filter. The remaining probability (1-p) is distributed evenly across the other motion models.

  • When specified as a vector, each element defines the probability of staying on each filter. The remaining probability (1-p) is distributed evenly across the other motion models evenly.

  • When specified as a matrix, the (j,k) element defines the probability of transitioning from the jth filter to the kth filter. All elements must lie on the interval [0,1], and each row must sum to 1.

The transition probability defined for each model corresponds to the probability that the filter switches from this model to another model in one second.

Example: 0.75

Data Types: single | double

Measurement noise covariance, specified as a positive scalar or positive-definite real-valued matrix. When specified as a scalar, the matrix is a multiple of the N-by-N identity matrix. N is the size of the measurement vector.

Specify MeasurementNoise before any call to the correct function.

Example: 0.2

Weight of each filter, specified as a vector of probabilities from 0 to 1. By default, the weight of each component of the filter is equal. L is the number of filters. The IMM filter updates the weight of each filter in the prediction step.

Data Types: single | double

Enable state smoothing, specified as false or true. When specified as true, you can

  • Use the smooth function to smooth the state estimates in the previous time steps.

  • Specify the maximum number of smoothing steps using the MaxNumSmoothingSteps property of the filter.


The smoothing capability is only supported when the trackingIMM object is configured with Gaussian filters.

Maximum number of backward smoothing steps, specified as a positive integer.


To enable this property, set the EnableSmoothing property to true.

Object Functions

predictPredict state and state estimation error covariance of tracking filter
correctCorrect state and state estimation error covariance using tracking filter
correctjpdaCorrect state and state estimation error covariance using tracking filter and JPDA
distanceDistances between current and predicted measurements of tracking filter
likelihoodLikelihood of measurement from tracking filter
cloneCreate duplicate tracking filter
initializeInitialize state and covariance of tracking filter
smoothBackward smooth state estimates of trackingIMM filter


collapse all

This example shows how to create and run an interacting multiple model (IMM) filter using a trackingIMM object. Call the predict and correct functions to track an object and correct the state estimate based on measurements.

Create the filter. Use name-value pairs to specify additional properties of the object.

detection = objectDetection(0, [1;1;0], 'MeasurementNoise', [1 0.2 0; 0.2 2 0; 0 0 1]);
filter = {initctekf(detection);initcvekf(detection)};
modelConv = @switchimm;
transProb = [0.9,0.9];
imm = trackingIMM('State',[1;1;3;1;5;1;1],'StateCovariance',eye(7),...

Call predict to get the predicted state and covariance of the filter. Use a 0.5 sec time step.

[xPred,pPred] = predict(imm,0.5);

Call correct with a given measurement.

meas = [1;1;0];
[xCorr,pCorr] = correct(imm,meas);

Continue to predict the filter state. Specify the desired time step in seconds if necessary.

[xPred,pPred] = predict(imm);         % Predict over 1 second
[xPred,pPred] = predict(imm,2);       % Predict over 2 seconds


[1] Bar-Shalom, Yaakov, Peter K. Willett, and Xin Tian. Tracking and data fusion. Storrs, CT, USA:: YBS publishing, 2011.

[2] Blackman, Samuel, and Robert Popoli. "Design and analysis of modern tracking systems." Norwood, MA: Artech House, 1999.

Extended Capabilities

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

Introduced in R2018b