This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


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
imm = trackingIMM(trackingFilters)
imm = trackingIMM(trackingFilters,modelConversionFcn)
imm = trackingIMM(trackingFilters,modelConversionFcn,transitionProbabilities)
imm = trackingIMM(___,Name,Value)


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.

  • 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 and column must sum to 1.

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 method.

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.

Data Types: single | double

Object Functions

predictPredict state and state estimation error covariance
correctCorrect state and state estimation error covariance
correctjpdaCorrect state and state estimation error covariance using JPDA
distanceDistances between measurements and predicted measurements
residualMeasurement residual and residual noise
cloneCopy filter for object tracking
initializeInitialize state and covariance of 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

Extended Capabilities

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

Introduced in R2018b