# Acceleration to displacement data based on accelerometer

3 visualizzazioni (ultimi 30 giorni)
MARLIANA HAFIZA il 12 Apr 2023
Modificato: Chunru il 12 Apr 2023
Hi,
Can anyone help to guide me on how to find the displacement value based on the acceleration result from accelerometer ? I already try to use several method that have been found but it seems not provide the good result and not understand much the given method. The attach excel file is acceleration output value from a wheel that have rotation of 400 rpm and my previous code that I used.
Fn = Fs/2;
Tr = linspace(num(1,1), num(1,end), size(num,1));
Dr = resample(num(:,2), Tr);
Dr_mc = Dr - mean(Dr,1);
FDr_mc = fft(Dr_mc, [], 1);
Fv = linspace(0, 1, fix(size(FDr_mc,1)/2)+1)*Fn;
Iv = 1:numel(Fv);
figure
plot(Fv, abs(FDr_mc(Iv,:))*2)
grid
xlabel('Frequency (Hz)')
ylabel('Amplitude')
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (1)

Chunru il 12 Apr 2023
Modificato: Chunru il 12 Apr 2023
Var1 Var2 Var3 Var4 ______ _______ _______ _______ 0 -1.7658 -0.2943 -0.5886 0.0238 -1.8639 -0.2943 -0.4905 0.0476 0 -0.1962 -0.4905 0.0714 -1.2753 -0.1962 -0.4905 0.0952 -1.3734 -0.1962 -0.4905 0.119 -1.2753 -0.1962 -0.4905 0.1429 -1.3734 -0.1962 -0.4905 0.1667 -1.3734 -0.1962 -0.4905
% initialize the velocity and position
v0 = [0 0 0];
s0 = [0 0 0]; % 3d
vt = v0 + cumtrapz(num{:, 1}, num{:, 2:end});
st = s0 + cumtrapz(num{:, 1}, vt);
whos
Name Size Bytes Class Attributes cmdout 1x33 66 char num 612x4 21215 table s0 1x3 24 double st 612x3 14688 double v0 1x3 24 double vt 612x3 14688 double
plot3(st(:,1), st(:,2), st(:,3), 'r.')
box on; grid on;
xlabel("x"); ylabel("y"); zlabel("z")
figure
plot(num{:, 1}, num{:, 2:end})
figure
plot(num{:, 1}, st);
figure;
plot(num{:, 1}, vt);
mean(num{:, 2:end}, 'omitnan')
ans = 1×3
-1.2512 -0.2125 -0.5284
##### 2 CommentiMostra NessunoNascondi Nessuno
MARLIANA HAFIZA il 12 Apr 2023
Thank you for your help. But, I quite confuse regarding the displacement value. That means based on the output given, the displacement keeps decreasing downwards even the acceleration result got upside down waveform ?
Chunru il 12 Apr 2023
Modificato: Chunru il 12 Apr 2023
See the update above. The general trend is determined by the mean value of the acceleration data, which are all negative as shown above. You can see the velocity is negative though fluctuating (due to the acceleration up and down)

Accedi per commentare.

### Categorie

Scopri di più su MATLAB Coder in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by