Polynomial curve fitting (improved)

Version 1.0.0 (1.67 KB) by Xiaoluo Yu
returns a polynomial p(x) with the coefficients z of degree m that is a best fit for the data in y without ill-conditioned errors.
84 Downloads
Updated 8 Jun 2020

View License

[p, z] = polyfit_mod(x,y,m) returns a polynomial p(x) with the coefficients z of degree m that is a best fit (in a least-squares sense) for the data in y.
The coefficients in z are in ascending powers, and the length of z is m+1.
It can be seen as an improvement of MATLAB function "polyfit", to avoid ill-conditioned errors caused by Gram matrix constructed by using natural basis.
Using orthogonal polynomial basis to construct Gram matrix and weight function is 1.
m: polynomial order
p: polynomial obtained by fitting
z: coefficients corresponding to each term of the polynomial

Cite As

Xiaoluo Yu (2026). Polynomial curve fitting (improved) (https://www.mathworks.com/matlabcentral/fileexchange/76724-polynomial-curve-fitting-improved), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2020a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Version Published Release Notes
1.0.0