How to change MPU6050 output rate?


I would like to know what is the correct way to change the output rate of the IMU. I searched on google but could not find a satisfactory answer.
I need to get the euler angles at a frequency of 10Hz.

I use the code found here: i2cdevlib/Arduino/MPU6050 at master · jrowberg/i2cdevlib · GitHub
For testing, I used this sketch: MPU6050_DMP6.ino (
The configuration is done in this file: MPU6050_6Axis_MotionApps20.h (i2cdevlib/MPU6050_6Axis_MotionApps20.h at master · jrowberg/i2cdevlib · GitHub)

The sample rate is set at line 359 of MPU6050_6Axis_MotionApps20.h:

DEBUG_PRINTLN(F("Setting sample rate to 200Hz..."));
setRate(4); // 1khz / (1 + 4) = 200 Hz

So I think I have to increase the divider to obtain the correct fraquency. But if I change this value even a little (e.g. 9 -> 1khz / (1 + 9) = 100 Hz) the IMU became really slow to react to the rotation and I have a big delay (some seconds). E.g. I swiftly rotate the IMU of 90° around an axis, but as output I see the angle value that slowly change and it takes several seconds to reach the correct value.

In addition, even maintaining the original value of the divider (4), when the program starts (with the IMU fixed) I see the angle value that slowly changes to reach a stable value after some seconds. The time taken to reach the stable value increases by decreasing the output frequency. There's something wrong in my IMU or this is the normal behaviour?

What's the reason of the delay? How I can change the output rate without having this delay?

Thank you.