Given acceleration data and the corresponding time, how can I find the position and velocity in MATLAB? -
i given data in excel spreadsheet. after importing velocity = cumtrapz(t,y)
, position = cumtrapz(velocity)
?
it correct if car starts 0 @ distance zero. otherwise need have initial velocity there well. notice here solving the equation a = f(t) = dv/dt
, further a = d^2s/dt^2
identifying v
ds/dt
. solving system of ordinary differential equations:
a = dv/dt v = ds/dt
this can done in few ways. eg euler forward.
v'(t) = (v(t+h)-v(t))/h <=> v(t+h) = hv'(t)+y(t)
where derivate given, means a = a(t)
. iteration initialized initial condition v(0)
, must given.
when know v
go s. use again euler forward as,
s'(t) = (s(t+h)-s(t))/h <=> s(t+h) = hs'(t)+s(t)
where must know initial condition s(0)
. if v(0) = s(0) = 0
. euler forward o(h) algorithm, knowing trick of solving differential equations step step doing transformation s'(t) = v(t)
possible better. runge-kutta method available you. , method use, cumtrapz, o(h^2) method. little more theory custom in stackoverflow, helpful. there matrix solution second order boundary value problems, called finite differance method, 1 slighly more advanced. further reading, start with
http://en.wikipedia.org/wiki/numerical_methods_for_ordinary_differential_equations
Comments
Post a Comment