Problem in Kalman Filter

1 view (last 30 days)
RUDRAKSH
RUDRAKSH on 5 May 2016
Edited: RUDRAKSH on 5 May 2016
By following http://www.mu-sigma.com/analytics/pdf/Technical%20Research/Prediction%20using%20Kalman%20Filter.pdf I'm trying to implement kalman filter for prediction. As though i do not have much exposure to kalman flter hence unable to debug what is going wrong.
Can any one help me
Following is the code in matlab:
l = length(PredictionMatrix);
R_K = 1;
H_K = [1];
F_K = [1];
P = eye(length(F_K));
X(1:length(F_K),1) = rand;
V_K(1:length(F_K)) = 10;
Xhat_K(1:length(F_K)) = rand;
Phat_K(1:length(F_K)) = 1;
for i = 2:1:l
Xhat_K(i,1) = F_K*X(i-1);
Phat_K(i,1) = F_K*P*F_K';
V_K(i,1) = PredictionMatrix(i,1) - H_K*Xhat_K(i,1);
Y_K(i,1) = H_K*Xhat_K(i)+V_K(i,1);
S_K = H_K*Phat_K(i)*H_K' +R_K;
W_K = Phat_K(i,1)*H_K'/S_K;
X(i,1) = Xhat_K(i,1)+W_K*V_K(i,1);
P = (Phat_K(i,1)-W_K*S_K*W_K')*P;
end
Xhat_K(i+1) = F_K*X(i);

Answers (0)

Community Treasure Hunt

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

Start Hunting!