Integration of numerical data

4 views (last 30 days)
Himalay Desai
Himalay Desai on 20 Jan 2020
Commented: Himalay Desai on 29 Jan 2020
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!

Accepted Answer

Sindar
Sindar on 20 Jan 2020
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 Comment
Himalay Desai
Himalay Desai on 29 Jan 2020
thank you so much for the answer. i tried this one and it worked.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!