# How to simulate IMU data and obtain variation of drift errors in the path?

52 views (last 30 days)
Shubham Kalpande on 5 Mar 2021
Answered: Brian Fanous on 9 Mar 2021
I want to study the variation of errors introduced when we integrate the IMU data to obtain position and orientation. This can be done by creating a path and then making an IMU sensor traverse this path (with the required acceleration and angular velocity inputs). Since we have only IMU data, the position and orientation can only be obtained by integrating the measurement data which will lead to integration drift since the measurements contain noise and other errors. I want to understand how does this drift varies with time and distance travelled by the vehicle containing this IMU setup.
Now, I am trying to use the imuSensor function to simulate IMU data. I am using the data from a MATLAB example - Model Tilt Using Gyroscope and Accelerometer Readings. Now since I am interested in knowing the position as well, I tried plotting the acceleration input and output as measured by the sensor model from MATLAB. But with zero input acceleration, I can see a huge variation in output acceleration. I am attaching the plots for reference. I dont understand what is happening here.
Also, it would be really nice if someone could help me give an outline to solve the problem using MATLAB i.e how to collect position and orientation data by using an IMU sensor only, attached to a UAV. I think the data can be simulated using imuSensor functionality but I am not sure how can I create the input parameters for it.
Also, what is the meaning of orientation in this function?
Thanks.
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Accepted Answer

Brian Fanous on 9 Mar 2021
For imuSensor, the input acceleration is the linear or translational acceleration in the global frame. The output acceleration is the linear/translational acceleration, plus gravity, plus noise all rotated into the sensor's frame. You are seeing the gravity comopnent in your output and it is likely varying because the sensor's orientation is changing.
The orientation input determines how the sensor is oriented relative to the global frame (NED or ENU). So for NED, if the input orientation is quaternion(1,0,0,0) you'd see 9.8 on the Z axis output. But if you change that orientation, you can move that gravity component across the X, Y and Z axes.
Please see the imuSensor reference page for a fuller description.
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Categories

Find more on Sensor Models in Help Center and File Exchange

R2020b

### Community Treasure Hunt

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

Start Hunting!