Azzera filtri
Azzera filtri

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

1 visualizzazione (ultimi 30 giorni)
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 Commenti
José-Luis
José-Luis il 8 Set 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 il 8 Set 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

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Programming in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by