image thumbnail

Least Squares Polynomial Fitting for Noisy Data

version 1.0.0 (3.59 KB) by Manuel A. Diaz
This snippet exemplifies the use of a custom LU decomposition method to produce a k-order polynomial fit to noisy data.


Updated 28 Apr 2021

View License

This snippet, is in reality the initial prototype I used for building my polynomial least squares class/module in C and Fortran, respectively. As you'll see, it matches perfectly the outputs for Matlab's polyval() and lu() functions. Although, is a very minimalist implementation of the LU decomposition method, it sometimes beats the polyval() function in speed. (Not sure why?!)

To understand how to use it, check out the example : FitPolynomialToNoisyData.m
( In it, I compare this implementation to Matlab's traditional tools/approaches )

Check it out! ;D

Cite As

Manuel A. Diaz (2021). Least Squares Polynomial Fitting for Noisy Data (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2019b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!