Introduction - If you have any usage issues, please Google them yourself
Least Squares optimal affine subspace
The zip includes:
(1) lsqAffineSpace: a low level routine that takes a set of m-dimensional real sample data and returns the optimal-fit k-dimensional affine subspace, with some options for discarding outliers.
(2) lsqPlane and lsqLine: lsqAffineSpace wrappers, that compute optimal line and hyperplane (plane, if the samples are 3-vectors) of the input samples.
(3) lsqAffineTestScript: demonstrating usage of the functions.