1c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathtypedef Matrix<float,Dynamic,2> DataMatrix;
2c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// let's generate some samples on the 3D plane of equation z = 2x+3y (with some noise)
3c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan KamathDataMatrix samples = DataMatrix::Random(12,2);
4c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan KamathVectorXf elevations = 2*samples.col(0) + 3*samples.col(1) + VectorXf::Random(12)*0.1;
5c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// and let's solve samples * [x y]^T = elevations in least square sense:
6c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan KamathMatrix<float,2,1> xy
7c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath = (samples.adjoint() * samples).llt().solve((samples.adjoint()*elevations));
8c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathcout << xy << endl;
9