Need help? Leave a comment below (if this is posted on your blog) or check the README.txt inside the download folder.
% Noise covariances sigma_process_pos = 0.01; sigma_process_vel = 0.1; Q = diag([sigma_process_pos^2, sigma_process_vel^2]); % process noise R = 1.0; % measurement noise variance kalman filter for beginners with matlab examples download
% Run the Kalman filter for i = 1:length(t) % Prediction step x_pred = A * x_est; P_pred = A * P_est * A' + Q; Need help
% --- Calculate RMS Error --- pos_error_kf = sqrt(mean((x_hist(1,:) - x_true(1,:)).^2)); pos_error_meas = sqrt(mean((measurements - x_true(1,:)).^2)); fprintf('RMS Position Error:\n'); fprintf(' Raw Measurements: %.3f m\n', pos_error_meas); fprintf(' Kalman Filter: %.3f m\n', pos_error_kf); fprintf('Improvement: %.1f%%\n', (1 - pos_error_kf/pos_error_meas)*100); % Generate some measurements t = 0:dt:10; x_true
Intuition: Our uncertainty drops because we incorporated a measurement.
% Generate some measurements t = 0:dt:10; x_true = sin(t); v_true = cos(t); y = [x_true; v_true] + 0.1*randn(2, size(t));
): A highly-rated tutorial by Alex Blekhman that uses a simple "train position" example to explain the filter without heavy matrix algebra. Kalman Filter for Beginners Tutorial Site