Is it possible to decorrelate accelerometer data in real-time? If so, how is it done?

Background:
My application is receiving (X,Y,Z) accelerometer data in real-time (sample rate is 6.75Hz). The sensor is moving in a periodic motion but the motion is not necessarily along only one axis. The 3 signals x(t), y(t) and z(t) are therefore slightly correlated and I would like to know if I can find a rotation matrix (in real time) which can be used to rotate the measured (x,y,z) into a new vector (x\*,y\*,z\*) so that the entire motion is along the z-axis?

I would like to implement the algorithm in C.
Thanks.