Remove gravity component from accelerometer data

88 ビュー (過去 30 日間)
Francesco Lucarelli
Francesco Lucarelli 2021 年 7 月 23 日
コメント済み: Mathieu NOE 2021 年 7 月 23 日
Hi all,
could you advice me a method to remove the gravity component from my 3-axis accelerometer data?
Thank a lot for your help and time, much appreciated!
I've shared also my x y and z. thanks a lot!!

採用された回答

Mathieu NOE
Mathieu NOE 2021 年 7 月 23 日
hello Francesco
the simplest method is to simply remove the mean value of your signal.
another approach is to use a high pass filter, this can also be useful if you want to remove very low frequency drifts or motion effects .
tested on you x data , you can easily copy paste on y and z data;
plot :
code :
clc
clearvars
load('x.mat');
% load('y.mat');
% load('z.mat');
% Time
dt = 1e-3; % Length of each time step
samples = length(x);
t_ac = (0:samples-1)'*dt;
fs = 1/dt; % Frequency [Hz] or sampling rate
% acc = x(:)*9.81; % Add gravity factor (assumes data in g)
acc = x(:); % No gravity factor (assumes data in m/s²)
% remove "gravity" acceleration
% method 1 : remove mean value
acc_ref = mean(acc);
acc2 = acc - acc_ref; % ??
% method 2 : high pass filtering
N = 2;
fc = 1; % Hz
[B,A] = butter(N,2*fc/fs,'high');
acc3 = filter(B,A,acc);
figure(1)
plot(t_ac,acc,t_ac,acc2,t_ac,acc3);
title('acceleration (unit ?)');
xlabel('Time (s)')
ylabel('Amplitude (unit ?)')
legend('raw','mean removed','high pass filtered');
  2 件のコメント
Francesco Lucarelli
Francesco Lucarelli 2021 年 7 月 23 日
Thank a lot @Mathieu NOE
Much appriciated !!
Mathieu NOE
Mathieu NOE 2021 年 7 月 23 日
you're welcome !

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Objects についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by