Acceleration to displacement data based on accelerometer
1 次查看(过去 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')
0 个评论
回答(1 个)
Chunru
2023-4-12
编辑:Chunru
2023-4-12
num=readtable("https://www.mathworks.com/matlabcentral/answers/uploaded_files/1352749/Book5.csv");
head(num);
% 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
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')
2 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!