# Compute unknown matrices that minimize a sum

This problem is about working with smart-phone accelerometers.

To calibrate accelerometer, I need to find three unknown matrices T, K and B that minimize this sum: $$\sum_{i=0}^N(|g|^2 - |TK(a_i + B)|^2)^2,$$ where $a_i$ is a known 3x1 vector and |$g$| is a known constant and unknown matrices are: $$T = \begin{bmatrix} 1 & t_1 & t_2 \\ 0 & 1 & t_3 \\ 0 & 0 & 1\end{bmatrix},\ K=\begin{bmatrix} k_1 & 0 & 0 \\ 0 & k_2 & 0 \\ 0 & 0 & k_3\end{bmatrix},\ B=\begin{bmatrix} b_1 \\ b_2 \\ b_3\end{bmatrix}.$$

I have read in an article one can solve such problems by Levenberg-Marquardt (LM) algorithm. Unfortunately I cannot figure out how. Can anyone suggest a solution to this minimization problem? And I need to implement the algorithm in python so if you know any good python library please name it.

• Have you tried following the derivation in the Wikipedia article on LM? Have you tried looking for an explanation of LM in a textbook?
– D.W.
Jun 17, 2018 at 16:13