Lagrange Interpolator Polynomial

Version (15.8 KB) by Dan Ellis
Find the polynomial (defined by its coefficients) passing through a set of points.


Updated 7 Dec 2006

View License

The two inputs X and Y are vectors defining a set of N points. The function uses Lagrange's method to find the N-1th order polynomial that passes through all these points, and returns in P the N coefficients defining that polynomial. Then, polyval(P,X) = Y.
R returns the x co-ordinates of the N-1 extrema/inflection points of the resulting polynomial (roots of its derivative), and S returns the value of the polynomial at those points.

For a general-purpose way to find a smooth curve connecting points, you probably want to use SPLINE instead.

Cite As

Dan Ellis (2023). Lagrange Interpolator Polynomial (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2006b
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!


Version Published Release Notes

- added example to comments as per code metrics report
- removed spurious Mac OS X files from zip archive