end
( 14.EKF )
end
To give you a preview of the MATLAB examples highlighted in Phil Kim's book, here is a simple script demonstrating a 1D Kalman Filter estimating a constant voltage contaminated by severe measurement noise. end ( 14
Think of it as a smart algorithm that combines two sources of information to find the truth:
% Define system parameters A = [1 0; 0 1]; H = [1 0; 0 1]; Q = [0.1 0; 0 0.1]; R = [0.5 0; 0 0.5];
% Run Kalman filter x_est = zeros(size(t)); P_est = zeros(size(t)); for i = 1:length(t) if i == 1 x_pred = x0; P_pred = P0; else x_pred = A*x_est(:,i-1); P_pred = A*P_est(:,i-1)*A' + Q; end K = P_pred*H'/(H*P_pred*H' + R); x_corr = x_pred + K*(z(i) - H*x_pred); P_corr = (1 - K*H)*P_pred; x_est(:,i) = x_corr; P_est(:,i) = P_corr; end Found a better resource for MATLAB beginners
Because of its massive popularity among engineering circles, copies of the text are highly sought after.
If you’ve ever tried learning the Kalman filter from academic papers full of dense matrix math, you know the pain:
Corrects the prediction using the actual sensor measurement ( H = [1 0
Phil Kim’s Kalman Filter for Beginners: With MATLAB Examples
Have you used Phil Kim’s book? Found a better resource for MATLAB beginners? Drop a comment below!
) changes as the filter becomes more confident in its estimates.