Can't change MeasurementNoise value in trackingIMM filter

1 view (last 30 days)
Hi eveyone, I'm trying to implement an IMM (Interactive Multiple Model) filter using the trackingIMM function which is made by 3 filters that I previously define, in order to track a moving object.
At each time step I may have a different number of available measurements, and thus the 'MeasurementNoise' parameter (called R) inside the trackingIMM function needs to be changed accordingly (in my case it will be a square matrix, with dimensions equals to the number of available measurements at that specific time).
The problem I'm facing is that after setting the 'MeasurementNoise' parameter and calling the "correct" function, it does not let me change the R matrix anymore.
I provide a partial desrciption of the code in which I'm facing the problem:
Definition of the IMM filter
filter_IMM = trackingIMM({filter_CV,filter_CA,filter_CTR});
filter_IMM.MeasurementNoise = [1 0; 0 1];
Prediction and Correction functions are then called with suitable input parameters
[xpred, Ppred] = predict(filter_IMM);
[xcorr, Pcorr] = correct(filter_IMM,measurement,Transmitters,parameters);
At the following iteration, I'd like to change R as follows (identity 4x4 matrix):
filter_IMM.MeasurementNoise = [1 0 0 0; 0 1 0 0; 0 0 1 0; 0 0 0 1];
But the following error occurs: Expected MeasurementNoise to be a scalar or 2-by-2 matrix.
This only happens if I try to change if after the predict and correct function, while if I change it before them the error does not occur.
Is there a way around to tackle this problem? Thank you very much.

Answers (1)

Elad Kivelevitch
Elad Kivelevitch on 29 Dec 2021
Hi,
In all the tracking filters, the measurement size is non-tunable, because it is needed for code generation.
If you want to have measurements that are sometimes 2-elements long and sometimes 4-elements long (and have measurement noise that is 2x2 and then 4x4, respectively), you will need to pad the shorter measurements with additional zeros.
You can see the answer here:
Thanks,
Elad

Community Treasure Hunt

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

Start Hunting!