Code covered by the BSD License  

Highlights from
Introduction to Unscented Kalman Filtering

image thumbnail

Introduction to Unscented Kalman Filtering

by

 

04 Aug 2009 (Updated )

Unscented Kalman filtering tutorial: Simulink and tilt sensor case study.

compare_error_variance_1run.m
% Error variance analysis for 1 simulation run
%
% An example for Rapid STM32 Blockset 
%
% Application Note AN1 Developing a Tilt Sensor System Using Rapid STM32 Blockset
%
% Copyright 2009 Krisada Sangpetchsong
%
% Visit  www.rapidstm32.com for further information

% Import data from saved work space data

time = error_variance.time;
true_roll_error_deg = error_variance.signals(1).values(:,1);
theoretical_roll_error_deg = error_variance.signals(1).values(:,2);
true_pitch_error_deg = error_variance.signals(2).values(:,1);
theoretical_pitch_error_deg = error_variance.signals(2).values(:,2);

% Compute actual error standard deviation
actual_roll_std_deg = std(true_roll_error_deg);
actual_pitch_std_deg = std(true_pitch_error_deg);

% Plot results
subplot(2,1,1)
plot(time,true_roll_error_deg,'r-',time,theoretical_roll_error_deg,'b-',time,...
    -theoretical_roll_error_deg,'b-')
ylabel('Roll Errors (deg)'), xlabel('time (sec)')
legend('Actual errors','\surd(P_{11})')
text(0.05,0.2,['Actual roll error std = ' num2str(actual_roll_std_deg) 'deg'],'unit','normalized')

subplot(2,1,2)
plot(time,true_pitch_error_deg,'r-',time,theoretical_pitch_error_deg,'b-',time,...
    -theoretical_pitch_error_deg,'b-')
ylabel('Pitch Errors (deg)'), xlabel('time (sec)')
legend('Actual errors','\surd(P_{22})')
text(0.05,0.2,['Actual pitch error std = ' num2str(actual_pitch_std_deg) 'deg'],'unit','normalized')

Contact us