Finding Affine Transform with Linear Least Squares

linear least squares is a method of fitting a model to data in which the relation between data and unknown paramere can be expressed in a linear form. $$Ax=b$$ $$X^{*}= \underset{x}{\mathrm{argmin}}= \|Ax-b\|^{2} =(A^{T}A)^{-1}A^{T}b$$

And testing the code: