# Thread: Compensating for Accelerometer Misalignment

1. ## Compensating for Accelerometer Misalignment

Hello
I am developing a programme in C that uses a Tri Axial Accelerometer and I have become bogged down with the maths for correcting cross axis misalignment errors and was wondering if someone could help me please.

I have two papers on the subject and I have worked my way through the axis offset and scaling. But I am finding this matrix inversion and transposition more than a handful.

The papers are to be found here:

This one is the general math
http://www.summitinstruments.com/kno.../pdf/TN413.pdf

This one is to an application note from the manufacture of the device I am
using (or similar)

http://www.st.com/stonline/products/...e/an/17289.pdf

From Page 9 on is the alignment error correction stuff.
I have created a Table 2 and written the software to do Equation 1 (I think it is correct). I have managed to write a Matrix Inversion function that I think is correct as I have compared it with the Determinant and Inverted Output from the Online Matrix calculator here; Online Matrix Calculator

But now I am stuck, help would really be appreciated.

2. Good grief!

Welcome to the forum, but how can your math or program be looked at, when you don't post your work?

You've studied the problem, you've checked your results - they appear correct you say - so what EXACTLY are you stuck on?

On a forum like this, you have to be VERY specific about what your problem is, and show what you're doing with your work. General questions get general answers, that generally, are not that helpful.

Good grief!

Welcome to the forum, but how can your math or program be looked at, when you don't post your work?

You've studied the problem, you've checked your results - they appear correct you say - so what EXACTLY are you stuck on?

On a forum like this, you have to be VERY specific about what your problem is, and show what you're doing with your work. General questions get general answers, that generally, are not that helpful.

Well I posted the question in a general manor as I have been writing C/C++ for many years now so it is not really a line of code does not compile or how do I pass a pointer to a multi dimensional array question.

It is a broad question because I was looking for someone who understands matrix maths and also understand the concepts in the papers from the links. As I have read through them a few times now and have an inkling of what need to be done but it is not 100% clear.

Hence my asking for help is for someone who understands this stuff that could guide my programming skills to find a solution.

Again many thanks for your post

4. For the calibration phase only you need to do one matrix divide. Given the online matrix inverter you found, you can achieve A/B by doing A * 1/B. That is, multiply matrix A by the inverse of matrix B. That will give you the correction matrix that's applied from then on to all output from the misaligned accelerometer.