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

1 vue (au cours des 30 derniers jours)
Ross Hanna
Ross Hanna le 8 Sep 2017
Commenté : Robert U le 8 Sep 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 commentaires
José-Luis
José-Luis le 8 Sep 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 le 8 Sep 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

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Engines & Motors dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by