Data fusion is a multilevel and multifaceted process that deals with the combination of data and information from single and multiple sources to achieve enhanced accuracy and precision. Development of algorithm plays significant role in the performance of data fusion system. The authors present two algorithms to fuse the data obtained from an accelerometer and gyroscope in an Inertial Measurement Unit (IMU). They employ well-known Kalman filter algorithm and then they propose a new algorithm, namely decentralized data fusion algorithm based on Factor analysis model. After comparing the performance of both the algorithms, they switch their study to optimize the code.