pointx andpointy are two vectors of data values,x is a vector of points where you want to interpolate. For example:
x = 0:10;
y = x.^2;
xx = linspace(0,10);
yy = lagrange(xx,x,y);
plot(x,y,'o',xx,yy,'.')
As an aside, with no offense intended to Calzino, there are other options available for interpolation. Firstly, of course,interp1 is a standard MATLAB function, with options for linear, cubic spline, and PCHIP interpolation. Cleve Moler (aka The Guy Who Wrote MATLAB) also has aLagrange interpolation function available for download.
Best Answer