Problem in Kalman Filter
Afficher commentaires plus anciens
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);
Réponses (0)
Catégories
En savoir plus sur State Estimation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!