MATLAB Answers

0

Getting velocity from acceleration using cumsum

Asked by Sam Thorpe on 12 Mar 2019
Latest activity Commented on by Adam Danz
on 8 Jul 2019
Hi, I have been given a set of data which includes acceleration, velocity and time from an experiment. We have been asked to process the data in a specific manner so we can calculate the transmission loss based on some gicen equations. I am not sure how to go around starting this section. I know how to load the data but am unsure what is asking when we have to convert the acceleration into velocity. I have the following eqations given:
a=acceleration
v=velocity
t=time
v(t) =integral of acceleration with respect to time (int (a) dt) with the limits between 0 and t
and v(t)=cumsum(a)* change in t
Does anyone have any ideas on how the cumsum function changes the integration?
Thanks

  0 Comments

Sign in to comment.

2 Answers

Answer by Matt J
on 12 Mar 2019

cumsum(a)*dt
is a discrete approximation to the integral of a from 0 to dt*length(a).

  0 Comments

Sign in to comment.


Answer by Adam Danz
on 12 Mar 2019
Edited by Adam Danz
on 12 Mar 2019

Units of acceleration are typically m/s^2 (meters per second squared). Time is typically in seconds. So when you multiply (m/s^2) by (s) the results is (m/s) or, meters per second (which are the units for velocity). Multipying acceleration by the change in time gives you the change in velocity. Here's an example.
If a car is accelerating at 10 m/s^2 for 5 seconds, then 10 m/s^2 * 5 s = 50 m/s. So, there is a 50 m/s increase in velocity. But you still don't know the absolute speed of the car because you don't know it's starting speed. If the starting speed was 2 m/s then 2 + 50 = 52 m/s absolute speed.
Now let's say you have vectors of data where each element of the vector was recorded at different time points.
acceleration = [0 1 1 2 2 2 5 5 5 2 2 1 1 0]; %m/s^2
dt = 0.2; % change in time (seconds)
The instantaneous change in velocity would be
dtVel = acceleration .* dt;
And the absolute velocity would be (assumes velocity starts at 0m/s at time 0)
vel = cumsum([dtVel]); %m/s
View the data
time = dt * (0:length(acceleration)-1);
figure; plot(time, acceleration, 'b-', time, vel, 'r-')
legend('Accel.', 'Vel.')
xlabel('time (s)')

  2 Comments

thanx for the easy-to-follow explanation.I had a similular issue
can you please tell me why in
Calculate Velocity and Position
edot = (1/200)*cumsum(dataOfInterest.EastWest);
edot = edot - mean(edot);
he subtracted the mean(edot) from edot??
(1/200) is the dt in your explanation and "dataOfInterest.EastWest" the acceleration.
Thank you
It appears that the velocities are normalized to have a mean of 0 (or very close to zero).

Sign in to comment.