how to get matlab to differentiate in increments of 1 rather than 0.01

1 visualización (últimos 30 días)
Ross Hanna
Ross Hanna el 8 de Sept. de 2017
Comentada: Robert U el 8 de Sept. de 2017
Hi there. I am trying to use forward velocity data from a motorcycle to find the suspension position. When doing this i need the acceleration so i differentiate the data i have using diff() to give the acceleration. When i do this however the answer is a factor of 100 out. When trying to find the cause i noticed that the recording module takes readings every 100th of a second. i get that MATLAB is essentially finding the gradient between my two data points then the next, then the next. My question is, how do i get matlab to find dx/dt in one second increments rather than 100th's of a second? thanks
  2 comentarios
José-Luis
José-Luis el 8 de Sept. de 2017
I don't get it.
If you are doing this numerically, a finer gradient would just be a linear interpolation. Am I missing something?
Just resample() your data and calculate the gradient on that.
Robert U
Robert U el 8 de Sept. de 2017
Hi Ross Hanna,
either you take every 100th sample which would result in a loss of information or you have to remember that dx/dt in time discrete systems is approximated by (x(t2)-x(t1))/(t2-t1) where diff(x) is giving you only the x-part of the approximate.
In order to correct the faulty factor 100 you would have to divide diff(x) by the corresponding time steps.
Kind regards,
Robert

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Engines & Motors en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by