Acceleration to displacement data based on accelerometer

6 次查看(过去 30 天)
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.
Thanks in advance !
num=csvread("Book5.csv");
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')

回答(1 个)

Chunru
Chunru 2023-4-12
编辑:Chunru 2023-4-12
num=readtable("https://www.mathworks.com/matlabcentral/answers/uploaded_files/1352749/Book5.csv");
head(num);
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 个评论
MARLIANA HAFIZA
MARLIANA HAFIZA 2023-4-12
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
Chunru 2023-4-12
编辑:Chunru 2023-4-12
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)

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Propagation and Channel Models 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by