how to get matlab to differentiate in increments of 1 rather than 0.01
조회 수: 1 (최근 30일)
이전 댓글 표시
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
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
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 Exchange에서 Engines & Motors에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!