Implementation of an extended kalman filter for accelerometer data
11 views (last 30 days)
Show older comments
I have a set of real world accelerometer and GPS (GPS is optional) values that I would like to use to develop a navigation system. I beieve I have to use the commands 'insfilter' and 'trackingEKF' however i am getting difficulty in these working. When using both of these functions i get the error: "Array indices must be positive integers or logical values."
The code I have so far is as follows and regards removing outliers from the data:
clc;
close all;
clear;
workspace;
set(0, 'DefaultAxesFontSize', 15)
%--------------------------------------------------------------------------%
% Define parameters
D=csvread('test20m3.csv'); %Read CSV file
t=D(:,1); %Define time
XAccRaw=D(:,5); XAcc=XAccRaw*9.81; %Define and convert acceleration in x-axis m/s^2
%--------------------------------------------------------------------------%
% Plotting raw acceleration = x-axis
hFig1 = figure(1); %Define first figure
plot(t,XAcc,'b.-','MarkerSize',5); %Plot raw acceleration against time
grid on; %Turn plot grid on
hold on; %Hold the plot
fontsize=15; %Increase font size
title('Raw acceleration against time','FontSize',fontsize); %Title the graph
xlabel('Time (s)','FontSize',fontsize); %Label x-axis
ylabel('Acceleration (m/s^2)','FontSize',fontsize); %Label y-axis
hFig1.WindowState='maximized'; %Enlarge the figure window to full screen
yline(0,'k','LineWidth',1); %Draw a line at y=0
% Removing outliers from data
XoutlierIndexes = isoutlier(XAcc); %Outline accelerometer outliers
plot(t(XoutlierIndexes), XAcc(XoutlierIndexes), 'ro', 'MarkerSize', 15); %Highlight outliers on plot
TX=t(~XoutlierIndexes); %Define good data points w.r.t. time
AX=XAcc(~XoutlierIndexes);
0 Comments
Answers (1)
See Also
Categories
Find more on Tracking and Sensor Fusion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!