# set process noise 1D Constant Velocity

2 views (last 30 days)
Per Zetterberg on 20 Jun 2019
Hi,
I can define a Kalman filter with the code:
KF = trackingKF ('MotionModel','1D Constant Velocity');
How do I set the process noise? I mean I can set it with e.g:
KF.ProcessNoise=eye(2);
but since the process noise should be a function of one parameter only there should be som other way.
BR/
Per

Elad Kivelevitch on 26 Jun 2019
Per,
Thanks for the question.
I think I understand your confusion, but let's see if I do. You expect the process noise to be a*Bmat(dt) where a represents the magnitude of the process noise and Bmat(dt) is a time dependent factor that multiplies the acceleration according to the time difference, dt.
We currently don't have that option when you use trackingKF with a defined MotionModel. When you call predict(KF, dt), we assume that a=1 and then the process noise is simply [0.25 0.5;0.5 1];
There are two ways around that:
1. You can use a trackingEKF (or a trackingABF) and set it to a constant velocity model.
2. You can use trackingKF with a Custom motion model and set ProcessNoise yourself at every step.
Option 1: trackingEKF
sigmasq = 3;
[x_pred,P_pred] = predict(EKF,2) % Predict 2 seconds to the future
Note that P_pred is calculated correctly by taking into account the process noise, sigma, as an acceleration term.
Option 2: trackingKF with custom model:
% Defind the KF custom model:
A = [1 1;1 0];
H = [1 0];
KF = trackingKF(A,H)
% Now predict with sigma = 3 and dt = 2
sigmasq = 3;
dt = 2;
Q = sigmasq * [dt^4/4 dt^3/2; dt^3/2 dt^2];
A = [1 dt; 0 1];
[x_pred, P_pred] = predict(KF, A, Q)
Hope this helps,

R2019a

### Community Treasure Hunt

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

Start Hunting!