I try to find the air under the curve of this signal
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Kober Florian
am 18 Apr. 2021
Kommentiert: Kober Florian
am 18 Apr. 2021
Hello everyone,
For a project, I made an acquisition of accelleration data with a sensor. I would like to find the distance from these acceleration data for that I focus on the z axis.
datacq= load('Acquisition.txt');
datacq(:,1)=datacq(:,1)-datacq(1,1)
t=datacq(:,1)*10^-3
%accelerationx=abs(datacq(:,2))
%accelerationy=abs(datacq(:,3))
accelerationz=abs(datacq(:,4))
figure
% subplot(2,1,1)
% plot(t,accelerationx)
% subplot(2,1,2)
% plot(t,accelerationy)
% subplot(2,1,3)
plot(t,accelerationz)
hold on
% processing
ax=datacq(:,4);
ax=abs(ax);
figure
plot(ax)
hold on
for i=1:250
vx(i)=(trapz(ax(1:i))*t(2));
%Ret(i) = vx(i+1)-vx(i);
end
plot(vx)
distance = trapz(vx(1:251)*t(2))
I did this but it's not working, it's false. Could you help me please?
Respectfully FK
0 Kommentare
Akzeptierte Antwort
Alan Stevens
am 18 Apr. 2021
Like this?
datacq= load('Acquisition.txt');
datacq(:,1)=datacq(:,1)-datacq(1,1);
t=datacq(:,1)*10^-3;
accelerationz=abs(datacq(:,4));
figure
plot(t,accelerationz)
% processing
dt = t(2)-t(1);
ax=datacq(:,4);
%ax=abs(ax);
vx = cumtrapz(ax)*dt;
dx = cumtrapz(vx)*dt;
figure
subplot(3,1,1)
plot(t,ax),grid
ylabel('ax')
subplot(3,1,2)
plot(t,vx),grid
ylabel('vx')
subplot(3,1,3)
plot(t,dx),grid
xlabel('t'), ylabel('dx')
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Subplots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!