MATLAB Answers

Problem with Interactive Multiple Model and Tracking Toolbox

5 views (last 30 days)
Andrea Zuccotto
Andrea Zuccotto on 24 Apr 2020
Answered: Elad Kivelevitch on 8 Sep 2020
Hi everybody!
I would like to use the "trackingIMM" object for a slightly different application.
Basically instead of tracking a moving object via Kalman Filter I would like to observe a Dynamic System with parameter uncertainties.
The chosen system it's a linear oscillator with linear ordinary differential equations in the form of:
M*diff(x(t), t, 2) + C*diff(x(t), t) + K*x(t) == F(t);
with F(t) being a step input. Now the idea it is to run 2 Kalman filters in parallel, one with say M1, K1, C1 parameters and the other with M2, K2, C2.
K1 = 20; % [N/m] stiffness
K2 = 15; % [N/m] stiffness
M1 = 10; % [Kg] mass
M2 = 14; % [Kg] mass
C1 = 1; % [N*s/m] damping
C2 = 1; % [N*s/m] damping
% x(t+1) = A*x(t) + B*u(t)
% y(t) = C*x(t)
A1 = [0 1; -K1/M1 -C1/M1]; % dynamical matrix
B1 = [0; 1/M1]; % input vector
C = [1 0]; % measurment relation vector - measuring position
With IMM the aim it's to show that if I run a simulation of the real system with M1,K1, C1 the trackingIMM object should give the probability more to the first filter and so obtain an overall better measurment.
I've initialized both the trackingKF and trackingIMM objects:
% filter1
filter1 = trackingKF('MotionModel', 'Custom',...
'State', IC,... % Initial Condition as a parameter
'StateCovariance', StCov,... % Covariance as a parameter
'StateTransitionModel', A1,...
'ControlModel', B1, ...
'MeasurementModel', C,...
'MeasurementNoise', R,...
'ProcessNoise', diag([0 Q]));
initialize(filter1, IC, StCov )
%filter2
filter2 = trackingKF('MotionModel', 'Custom',...
'State', IC,...
'StateCovariance', StCov,...
'StateTransitionModel', A2,...
'ControlModel', B2, ...
'MeasurementModel', C,...
'MeasurementNoise', R,...
'ProcessNoise', diag([0 Q]));
initialize(filter2, IC, StCov )
filters = {filter1; filter2};
modelConv = @switchimm;
transProb = 0.5;
imm = trackingIMM('State', IC,...
'StateCovariance',StCov,...
'TrackingFilters',filters,...
'TransitionProbabilities',transProb,...
'MeasurementNoise', R,...
'ModelConversionFcn',modelConv);
But at this point I get an error with the @switchimm function handle: it tells me the model it's not recognized between constant velocity, constant acceleration, and constant turn. Is there a way to use an own model as the ModelConversionFcn property of the object?
I see that I'm trying to use it not for its proper application, but I was wondering if this is possible or if exist a workaround to solve the issue.
Thank you in advance.
Andrea

  2 Comments

Timothy Engstrom
Timothy Engstrom on 20 May 2020
Hi Andrea,
Did you find a solution to your problem? Perhaps you need to make a 'dummy' Model Conversion Function that outputs the same as the input?
Sugar Daddy
Sugar Daddy on 9 Jul 2020
I think this should be answer to every Sensor fusion and tracking toolbox questions

Sign in to comment.

Answers (1)

Elad Kivelevitch
Elad Kivelevitch on 8 Sep 2020
Andrea,
Apologies for the delay in response. The switchimm function is designed to be used with the models that we shipped in the Sensor Fusion and Tracking Toolbox. In other words, it will support constant velocity, constant acceleration, and constant turn. Since you're using a different model, you have to write your own switching function that can be used with your custom models.
There is a very good reason why that is the case. The switching function needs to convert from model one state space to model two state space. If we don't know what state definition you use in your custom function, we have no way of knowing how to convert it.
Elad

  0 Comments

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!