Polynomial curve fitting (improved)
[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
Platform Compatibility
Windows macOS LinuxTags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0 |
