What is the best way to fixe number jumps in GPS/IMU Data Plot

3 views (last 30 days)
Hey,
I hope someone has a tip on how to best correct jumps in position data from GPS/IMU. There is always a correction of the position when a new data set of the GPS receiver is available.
Which approach, function or method is best way to correct such data?
I am happy for any help :)

Answers (1)

Mathieu NOE
Mathieu NOE on 5 Oct 2021
hello
why not apply a smoothing filter - there are many options, maybe start with smoothdata
example code :
clc
close all
Fs = 1000;
samples = 1000;
dt = 1/Fs;
t = (0:samples-1)*dt;
y = square(2*pi*3*t) + 0.1*randn(size(t));
% %%%%%%%%%%%%%%%%
figure(1)
N = 25;
ys = smoothdata(y, 'gaussian' , N);
plot(t,y,t,ys);legend('Raw','Smoothed');
title(['Data samples at Fs = ' num2str(round(Fs)) ' Hz / Smoothed with smoothdata' ]);
% %%%%%%%%%%%%%%%%
figure(2)
N = 25;
ys = medfilt1(y, N,'truncate');
plot(t,y,t,ys);legend('Raw','Smoothed');
title(['Data samples at Fs = ' num2str(round(Fs)) ' Hz / Smoothed with medfilt1' ]);
grid on
%%%%%%%%%%%%%%%%
figure(3)
ys = sgolayfilt(y,1,21);
plot(t,y,t,ys);legend('Raw','Smoothed');
title(['Data samples at Fs = ' num2str(round(Fs)) ' Hz / Smoothed with sgolayfilt' ]);
grid on
%%%%%%%%%%%%%%%%
NN = 2;
Wn = 0.25;
[B,A] = butter(NN,Wn);
figure(4)
ys = filtfilt(B,A,y);
plot(t,y,t,ys);legend('Raw','Smoothed');
title(['Data samples at Fs = ' num2str(round(Fs)) ' Hz / Smoothed with butterworth LP' ]);
grid on

Tags

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!