The polyfit() function in Matlab can be used for least-squares curve fit for any given polynomial order. The method used by Matlab is to construct the Vandermonde matrix and then solve it via QR factorization.
However, why doesn't Matlab use a more direct method for solving a system of linear equations using the conditions for least-squares fit and matrix-inversion methods such as Gauss-eliminaton?
Best Answer