Integration of numerical data

4 次查看(过去 30 天)
Good evening!
I have a set of data collected from a gyroscope collected against time with a timestamp of 0.1 seconds. It contains both, positive and negative values. In order to obtain the angle, we have to integrate the angular velocity (data collected from MEMS and FIber Optic gyro) against time such. in this experiment, I have turned the gyroscope from 0 degrees to 30, from 30 degrees to 60 and then from 60 degrees to 0 again. theoretically, the answer of this integration should be zero as we are returning to the point where we originally started. but, the answer I'm getting here is 57.3920 degrees. It is understood that the funtion ' trapz() ' only evaluates the positive data points, thereby resulting to figure close to 60 degrees rather than zero. What funtion should I use in order to integrate this numeric data. Given below is the code for the same:
T30 = (deg30.Time);
M30 = (deg30.Mems);
F30 = -(deg30.Fiber);
intM30 = trapz(M30);
intF30 = trapz(F30);
note: also notice that the negative sign in the F30 function is for transponding the negative data points to the same side of the axis.
all attempts, successful or not, are appreciated!

采纳的回答

Sindar
Sindar 2020-1-20
It does not appear that trapz ignores negative data. Instead, I think you just need to give it your time data so that it can accurately integrate:
intM30 = trapz(M30,T30);
intF30 = trapz(F30,T30);
  1 个评论
Himalay Desai
Himalay Desai 2020-1-29
thank you so much for the answer. i tried this one and it worked.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Numerical Integration and Differentiation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by