Lagrange polynomial
% Polynomial Interpolation Problem: Lagrange Form
% x and y are vectors with the same dimensions
% Given n points: (x_k,y_k) k = 1,2,...n
% this function finds a polynomial P(x) of degree less
% than n such that P(x_k) = y_k
% --
% Remarks:
% The resulting polynomial is displayed in symbolic notation
% --
% Example
% x=[0 1 2 3 4 5 6 7];
% y=[4 -6 -1 16 -2 6 12 17];
% pol=show_polinterp(x,y);
% --
% x=[1 2 3 4 5 6 7];
% y=1+x.^3-x.^6;
% pol=show_polinterp(x,y);
%
% For evaluating pol, try
% subs(pol,x), it will return vector y
%--
Cite As
Ernesto Momox Beristain (2026). Lagrange polynomial (https://www.mathworks.com/matlabcentral/fileexchange/26724-lagrange-polynomial), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Acknowledgements
Inspired: poly2traj
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
LagrangePoly/
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0.0 |
