# How to convert accelerometer data to find displacement graph

114 visualizaciones (últimos 30 días)
Maaz Nayeem el 8 de Oct. de 2021
Respondida: Bora Eryilmaz el 21 de Mzo. de 2024
I have a triple axis accelerometer sensors. we are doing vibrational analysis for a Civil engg structure, we are able to successfully get raw data from the accelerometer (XYZ in g's). We transfered this raw data into matlab and did acceleration and Fast fourier transform plot to get frequency. We are stuck on writing the code to change the acceleration data into displacement. If anyone has any tips on where we should go with this, it would be greatly appreciated. Thanks in advance.I have attached the Accleration plot. I have tried using CumTrapz command but it dosent give proper results.
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

Mathieu NOE el 8 de Oct. de 2021
hello
see my suggestion below
clc
clearvars
data = csvread('data.csv',1); % time & Acceleration data
t = data(:,1);
acc = data(:,2);
acc = detrend(acc,'linear');
N = length(t);
dt = mean(diff(t)); % Average dt
fs = 1/dt; % Frequency [Hz] or sampling rate
% some additionnal high pass filtering
N = 4;
fc = 0.05; % Hz
[B,A] = butter(N,2*fc/fs,'high');
acc2 = filter(B,A,acc);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
velocity = cumtrapz(dt,acc2);
velocity = detrend(velocity,'linear');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
disp = cumtrapz(dt,velocity);
%
figure(1)
subplot(311),plot(t,acc);
subplot(312),plot(t,velocity);
subplot(313),plot(t,disp);
##### 10 comentariosMostrar 8 comentarios más antiguosOcultar 8 comentarios más antiguos
Riddhi el 22 de Ag. de 2023
How do we select the fc?
Walter Roberson el 22 de Ag. de 2023

Iniciar sesión para comentar.

### Más respuestas (1)

Bora Eryilmaz el 21 de Mzo. de 2024
The new convertVibration function in MATLAB R2024a release of the Predictive Maintenance Toolbox lets you compute baseline-corrected and filtered acceleration, velocity, and displacement signals from vibration measurements using a single sensor output from either an accelerometer, velocity sensor, or displacement sensor.
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Categorías

Más información sobre Spectral Measurements en Help Center y File Exchange.

### Community Treasure Hunt

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

Start Hunting!

Translated by