polynLagrange(xy)

Constructs the Lagrange interpolating polynomial.

xyIt is a matrix the first column of which contains the x values, the second contains the corresponding y values. It is expected to be sorted by x.
return valueInterpolating polynomial.

In comparison, the function polynInterp() does not calculate the coefficients, and hence is probably more efficient for a single interpolation.

xy = [-1,4; 4,8; 42,-88; 444, 827]; xunit = 1J; yunit = 1V; p=polynLagrange(xy * [xunit,0;0,yunit]) xmin = min(xy[...;0]); xmax = max(xy[...;0]); eps = (xmax-xmin)/200; xmin -= 2*eps; xmax += 2*eps; x = (xmin..eps..xmax)*xunit; y = p.polynEval(#x); [! xy[...;0]*xunit, p.polynEval(#(xy[...;0]*xunit))' !] plot(x,y)