Lagrange Interpolator Polynomial
by Dan Ellis
28 Nov 2006
(Updated 07 Dec 2006)
Find the polynomial (defined by its coefficients) passing through a set of points.
|
Watch this File
|
| File Information |
| Description |
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. |
| Acknowledgements |
The author wishes to acknowledge the following in the creation of this submission:
Lagrange polynomial interpolation, lagrange interpolation and derivative
|
| MATLAB release |
MATLAB 7.3 (R2006b)
|
|
Tags for This File
|
| Everyone's Tags |
|
| Tags I've Applied |
|
| Add New Tags |
Please login to tag files.
|
| Updates |
| 06 Dec 2006 |
Further improvements - more forgiving of input format (columns or rows), support the three-input form to behave like SPLINE, update documentation to refer to SPLINE (as a more modern version). |
| 07 Dec 2006 |
- added example to comments as per code metrics report
- removed spurious Mac OS X files from zip archive |
|
Contact us at files@mathworks.com