# Tilt Compass calibration using matrix multiplication: How to derive the soft iron 3 by 3 correction / calibration matrix values?

Magnetometers are useful but normally suffer from offset and magnitude errors. The offset (or hard iron) errors are corrected by adding half of the maximum minus the minimum readings for any given axis. The magnitude (or soft iron) errors can be corrected by deriving values to normalizing the maximum minus the minimum range for all 3 axes.

But is it correct to say this does not account for magnetometer imperfections where sensors aligned on the 3 (supposedly) orthogonal directions X, Y & Z sense magnetic fields when they should not?

Further, is it correct to say for a perfect magnetometer the soft iron correction matrix would appear as a 3 by 3 identity matrix. One which would imply no soft iron correction is necessary?

So, how are the values of the soft iron 3 by 3 correction matrix derived?

• I've skipped a couple of step between paragraphs above to make the question short and to the point. If I've skipped too much, let me know and I'll edit the question. Jun 3, 2023 at 15:00
• Isn't it a plain old coordinate transformation? Have you searched on that term yet? Jun 3, 2023 at 16:49
• Maybe I'm not looking under the correct "rock". The closest I've come is this 2 dimensional spread sheet solution. And it is not clear to me how to extend it to 3 dimensions. Jun 3, 2023 at 17:00
• What your reference is saying is to determine three different soft iron corrections by rotating the magnetometer in each of the three axes. This will give you a 2-dimension soft iron correction for the XY, XZ, and YZ planes. Then resolve the readings from your device into vectors that lie on each of these planes, apply the corrections, and go backwards to get a corrected 3D result. Jun 3, 2023 at 17:42
• Thank you for your comment @JohnBirckhead. I am not familiar enough with this subject to follow your suggestions. Can you go into more detail or, perhaps, compose an answer. I'll be glad to read it and follow up with an Accept once I get a grasp of what needs to be done. Jun 4, 2023 at 14:58