Implementation of an extended kalman filter for accelerometer data

50 views (last 30 days)
Jack Upton
Jack Upton on 19 Apr 2020
Answered: Ajay Pattassery on 27 May 2020
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:
close all;
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

Answers (1)

Ajay Pattassery
Ajay Pattassery on 27 May 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!