3D Tracking with IMU

Hi ,
i’m building a robot and i need it to return it position , i will to use mpu-6050 , and i found this :

but i don’t know how to apply this code in the arduino

can anyone help please ?

Not surprising since it is matlab code, not arduino code. Maybe start with an Arduino sketch: