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

1 回表示 (過去 30 日間)
Ross Hanna
Ross Hanna 2017 年 9 月 8 日
コメント済み: Robert U 2017 年 9 月 8 日
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 件のコメント
José-Luis
José-Luis 2017 年 9 月 8 日
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 2017 年 9 月 8 日
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

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeEngines & Motors についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by