Kalman Filter with log(x) as a state variable
Ältere Kommentare anzeigen
I'm trying to estimate an (extended) Kalman Filter where one of the state variables (say x_{3}) would be modeled as log(x_{3}). In my model, I need x_{3} to remain positive and one trick commonly used is to model log(x3) instead of x3.
Here is the code for a plain extended Kalman Filter:
% Loop over time
for t = 1:T
% Predict state vector
Xt_1(:, t) = muP + thetaP * Xt(:, t);
% MSE matrix state equation
Pt_1(:, :, t) = thetaP * Pt(:, :, t) * thetaP' + Sigmae;
% Measurement equation
y_hat = A + B' * Xt_1(:, t);
% fitting errors
errors = yields(t, :) - y_hat';
% estimate Jacobian
H = compute_jacobian(Xt_1, t);
% compute F
F = H * Pt_1(:, :, t) * H' + Sigmaz;
% Kalman gain
K = Pt_1(:, :, t) * B / F;
% state vector
Xt(:, t + 1) = Xt_1(:, t) + K * errors;
% MSE matrix state equation
Pt(:, :, t + 1) = (eye(3) - K * B') * Pt_1(:, :, t);
end
Basically I don't know what to modify, outside modifying the Jacobian and providing a log(x_{3}) initial value, if I want to model Xt=(x_{1},x_{2},log(x_{3})) instead of Xt=(x_{1},x_{2},x_{3}).
Do I need to amend the state equation at the predict and update stages?
Any idea? 🙏
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu State Estimation finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!