AltIMU-10 v4 programming with arduino

Hi i am working with the altIMU board to display attitude and heading information similar to that of an attitude indicator. I merged the 3 sensor program codes which i obtained from a forum to display the data on the arduino serial monitor. The program which i am using to display the pitch and roll (attitude) data starts to display nan after a short while when the program is run and i have no idea why. Any help would be great guys. Ill attach the links to where i code the various codes as well as codes.

sketch_dec03a.ino (551 Bytes)

Vector.ino (1.84 KB)

Output.ino (2.71 KB)

matrix.ino (1.55 KB)

I2C.ino (2.72 KB)

DCM.ino (6 KB)

Compass.ino (1.97 KB)

Did you miss part of you program when you attached it ?
nan indicates that the variable is Not A Number

By the way, it is much more convenient if you post the program here rather than attaching it.

Oh yes sorry all those files need to be uploaded together, thanks! Where in the program should i make changes to solve this problem? I do not understand most of the program codes haha.

It would be much easier to provide help if you could reduce the program to a simple single sketch that exhibits the problem and posted it here.