Acceleration to displacement integration. Displacement plot problems.
Show older comments
H *i,
I'm working on accelerometer data to obtain the displacement. After applying highpass filter I obtained pretty nice looking velocity graph but the displacement seems odd.
Here is my code:
if true
Fs = 25000; %%Sampling freq
T = 1/Fs; %%Period
t = 0:T:9.99996 ; %%time
L = 250000; %%signal length
[B,A] = butter(1,12.5/6250,'high'); %%highpass filter
g = szkolenie_diagnostyczneVIBstandPrzekBadnia(:,1); %%Force of gravity
a = g*9.81; %%acceleration
a_filtr = filter(B,A,a); %%acceleratiof w/o DC
%%%%%%%PLOTIN' ACELERATION %%%%%%%%%%%%%%%%%%%%%%
figure(1)
plot(t,a_filtr);
title('Acceleration');
ylabel('Acceleration(m/s^2)');
xlabel('Time(s)');
%%%%%%%TRAPEZOIDAL INTEGRATION(VELOCITY)
v_trapz = cumtrapz(t, a_filtr); %%trapezoidal integration
figure(3)
plot(t,v_trapz)
title('Trap Velocity');
xlabel('Time(s)');
ylabel('Velocity(mm/s)');
%%%%%%%TRAPEZOIDAL INTEGRATION(DISPLACEMENT)
d_trapz = cumtrapz(t, v_trapz);
figure(4)
plot(t,d_trapz)
title('TRAP DISPLACEMENT');
xlabel('Time(s)');
ylabel('Trap Displacement(um)');
end
So after saving my data as "g", and adjusting it as "a" I integrate it and plot obtaining this:

With around 10 different measurements, few are positive, others are negative.
Does anyone know what could be a problem here?
Thanks :)
Answers (0)
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!