Contents Previous Next Subchapters

Lagrange Polynomial Interpolation
Syntax lagrange(xdydxi)
See Also polyfit , cubespl , interp , interp2

Description
Returns the value of the Lagrange interpolating polynomial of a column vector valued function at a point. The interpolating polynomial has degree that is one less than the column dimension of xd and is equal to the j-th column of yd at the j-th element of xd. The row vector xd specifies the argument values that the polynomial interpolates. The real, double-precision, or complex matrix yd specifies the function values that the polynomial interpolates. The parameters yd and xd must have the same number of columns. The scalar xi specifies the point at which to evaluate the polynomial. If yd is real or double-precision, xd and xi must have the same type as yd. If yd is complex, xd and xi must be double-precision. The return value will have the same type as yd.

Example
     xd = [-1., 0., 2.]
     yd = [+1., 0., 4.]
     xi = 3. 
     print lagrange(xd, yd, xi)
returns
     9